[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2003-11-06
8
Medium Priority
?
1,137 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
ID: 9697118
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 33

Expert Comment

by:shalomc
ID: 9699884
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
ID: 9704354
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 58

Accepted Solution

by:
amit_g earned 1000 total points
ID: 9704950
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
 

Author Comment

by:adrian78
ID: 9705119
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
ID: 9705165
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
ID: 9705333
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
ID: 10165846
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

872 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