View Single Post
Old 07-21-2009, 10:18 AM  
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
An Improved Click Tracking Method, technical

I wrote previously how some sponsors strip the query string when receiving traffic from a header redirect (IOW, you lose your affiliate ID if you send traffic from a header redirect).

In search of a better solution to this so that I could have 100% reliable click tracking AND 100% of sponsors wouldn't lose my affiliate information I came up with this technique:

On any outgoing link, rather than sending them to a forwarding page add an onclick handler to the link tag:

Code:
<a href="http://somesponsor.com/?foo=bar" onclick="return clickTrack(yourTrackingId);">Some Anchor Text</a>
In your JS function "clickTrack" simply perform an AJAX request to your tracking script and pass in the necessary information you require for tracking. If you use Prototype something like this:

Code:
function clickTrack(id)
{
  var url = '/link?from='+escape(document.location.href.toString())+'&id='+id;
  new Ajax.Request(url, {
    method: 'get',
    onSuccess: function(transport) {
      return true;
    }
  });
	
  return true;  //Added in case the request fails... 
}
This was made simply as an example but it works great without worrying about how any sponsor will receive your clicks since they are all sent using the standard link. We're just adding in an in between step... Of course, you can add in any number of tracking items to be passed through such as which link on the page they clicked (specifically), the x, y coordinates of the click, sky is the limit and you have quite a bit more UI options since this is handled through Javascript.

Anyway, just thought I would share...
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote