views:

1156

answers:

5

Hi,

I am building a tracking system for refererrals to our websites and on behalf of other 3rd party website owners. This will include placing a cookie when a customer clicks through to the site and subseqently reading their ID from this cookie if they reach the defined 'success' page.

I have seen a number of different methods used for tracking and they all seem to fall into 2 categories:

  1. Including an IMG tag which will link to a script that processes what it needs to and returns an image

  2. Including an external javascript file, usually with the same approach as in 1 within tags.

What are the benefits of one approach over the other? I feel I must be missing something quite simple here however can only see that the javascript approach can be used to avoid image caching.

The server-side script is ASP.net

EDIT: The cookie / tracking approach is being used because it seems to be the industry standard, and we need to be able to track goals over a long period of time and / or many visits however alternatvies to this approach would be welcomed!

Thanks

+1  A: 

The img technique is more stealthy since it will work when Jscript is disabled. And it used to also work via email messages (but now imgs are no longer automatically loaded on most email readers.)

Larry K
Won't the NOSCRIPT tags take care of this? or is there situations where they don't work?
Macros
A: 

Check out this article.

Jeremy Sullivan
A: 

As you noted, javascript will avoid the image caching issue. A couple other issues:

  • the javascript option won't work for those with javascript disabled (or coming from non-javascript browsers or mail clients)
  • the 1x1 tracking image is fairly common, and there are some spyware and privacy software applications which will block such images (or flag them as a third party privacy concern), potentially causing some worry for your users
ahockley
+1  A: 

It's worth noting that many tracking software pieces like Google Analytics utilize 1x1 pixels. If you are trying to avoid caching you can set the cache expiration on the particular page so that content will not be cached on the user end. As it stands though you really just need the cookie to be set the one time and if the user has not cleared their cache on subsequent visits chances are they haven't cleared their cookies either.

You can use either method and expect that there will be some small percentage of users that monitor cookies or scripts and will try to avoid having your cookie set on their machine. Almost no one browses with images disabled.

Those users who fall into that minority of people who are paranoid about cookies and/or javascript will not generally affect your tracking information overall unless of course your site specializes in serving content to that demographic (highly technical users etc). So, I wouldn't go overboard on tailoring your solution for that minority unless absolutely necessary.

Harv
A: 

If you include an external script in the <head> section, it is downloaded and executed before the page is shown, so you are sure that if a user saw the page they got tracked. For <img> tags there is no such guarantee, as the user might navigate away before the browser launches the load request for that image.

So, if you want to optimize for trackability, use a <script>, but if you want to optimize for performance (no slowdown if the tracking site is slow), use an <img>.

The caching issue exists in both cases, and can be solved by sending correct headers from the server or by appending cache-busting arguments to the URL.

Joeri Sebrechts