Solved

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

Posted on 2003-11-06
8
1,096 Views
Last Modified: 2012-06-21
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!
0
Comment
Question by:adrian78
8 Comments
 
LVL 58

Expert Comment

by:amit_g
Comment Utility
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.
0
 
LVL 32

Expert Comment

by:shalomc
Comment Utility
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


0
 

Author Comment

by:adrian78
Comment Utility
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!
0
 
LVL 58

Accepted Solution

by:
amit_g earned 500 total points
Comment Utility
Both ways (Javascript or Image tag) willl call the page from the different domain and thus will execute your script. There is one problem though - since domain are different, you won't be able to read the cookie written by either of them directly. If you want to read the cookie of your domain (where the script is) you will have to do the actual redirection because unless top domain is yours, you will not get any cookie. If you want to read the cookie of the final domain, you will have to read it in javascript and pass it in the query string.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:adrian78
Comment Utility
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
0
 
LVL 58

Expert Comment

by:amit_g
Comment Utility
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.
0
 

Author Comment

by:adrian78
Comment Utility
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!
0
 

Expert Comment

by:ravijp
Comment Utility
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

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now