Link to home
Start Free TrialLog in
Avatar of adrian78
adrian78

asked on

embedded tracking code/pixel that calls an asp.net script from another website

I have an affiliate system setup that when a user clicks on a link a cookie is placed on that user's computer containing the referral's id and click id and then they are redirected to the targeted advertisers page.  Once a transaction has been completed on that advertisers web page I need a way for a script on my website to be called so that i can update that referrer info from a click to a sale.  How can I embed somethign onto a targeted website's page (such as the the thank you page) so that it calls an asp.net (.aspx) script that updates my database without leaving the advertisers webpage.  I know about invisible pixels with php and javascripts and stuff but I can't seem to get it working.  Is there anyone that can come up with some code that can be placed in their thankyou page that calls an asp.net script on my server?  Also, what security measures can be put in place to ensure that it is them that is calling the script.  Thanks!
Avatar of amit_g
amit_g
Flag of United States of America image

Did you try ...

<script language="JavaScript">
var MyImage = new Image();
MyImage.src = "http://YourSite//YourApplication/YourUpdateFile.aspx";
</script>

In YourUpdateFile.aspx you can do whatever you want to do.
adrian78,
The simplest way is to append the affiliate string to the image url, like this:

<img src="http://track.yourdomain.com/shim.asp?freak56" width="1" height="1">

If the affiliate ID is freak56, then the shim.asp script will read QUERY_STRING and redirect the browser to the actiual image.

You can find a transparent 1x1 pixel shim here.
http://genoma.unsam.edu.ar/~fernan/web_safe.html


Avatar of adrian78
adrian78

ASKER

Hey there,
That's not what i was trying to do.  I'm trying to be able to run a script on a website from a page on a different website:

example:

Thankyou.htm is displayed on  www.hello.com

I want to be able to place a piece of code/tracking image or something that will be albe to execute the script:

Yourwelcome.aspx?id=34&g=2 on www.goodbye.com

the script Yourwelcome.aspx?id=34&g=2 doesn't actually load anything for display.  It basically reads a cookie and updates the database... but i want to be able to do this without the user being redirected or leaving thankyou.htm on www.hello.com

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
How do people do it?!  There are lots of companies that do this sort of thing using a script as an image.. and they are able to do the same thing i'm trying to do... any ideas?! Thanks
The image (javascript or tag) method will let you call your script from the thanyou page. Pass something in the query string to identify the target site and you know where the request came from.
that's not exactly what the problem is.  a user clicks a link and a cookie is dropped on their computer (identifying the affiliate that referred them to the advertiser) and they are taken to the advertisers site.  Perhaps a day or so passes and then that user completes a sale on the advertisers site and so that advertisers thankyou.htm page loads up which contains my tracking pixel with the source being the script on my website (sale.php) for example.  The sale.php file gets executed but it can't read the cookie that identifies the affiliate... how can i get around this?!  i know there is a solution because lots of companies do it... i just haven't been able to figure it out.  :|  Thanks in advance!
It is very simple.

There are basically 4 entities involved here:

Merchant selling (Merchant)
Affiliate Software Provider (Provider)
Affiliate (affiliate)
Buyer (buyer)

1. When buyer first arrives at affiliate's site, and clicks on affiliate link, the affiliate link contains the affiliate's id, and the link is actually redirected to a script on Provider's site along with the id.

2. => It is the Provider's SCRIPT (at www.provider.com) that reads the affiliate id, adds one "CLICK" to the affiliate's stats, and then SETS A COOKIE on the buyer's computer.

3. The provider's script then redirects user to MERCHANT's site.

4. Merchant's THANK YOU PAGE has a embedded 1x1 pixel img tag, that calls a script on the PROVIDER's web site, again at www.provider.com

5. Since provider.com is the one that "PLACED" the cookie on the BUYER's computer in the first place, the script can also read the same cookie (as they are both on the same domain).

6. Provider.com script reads cookie and updates sale for affiliate.

7. BUYER never left MERCHANT's thankyou page, because all of this happened behind the scenes, thanks to the 1x1 pixel image tag that called the provider's script.

Hope this helps.

Regards,

Ravi Jayagopal
Founder & Software Architect
http://WebmasterInABox.net