Tracking File Downloads / Exit Links / Redirects
By peter.stilgoe
Whilst looking how to [tag]track PHP page redirects[/tag] I came across the following solution which seems to work perfectly using [tag]Google Analytics[/tag]:
“Google Analytics provides an easy way to [tag]track clicks on links[/tag] that lead to file downloads. Because these links do not lead to a page on your site containing the tracking code, you’ll need to tag the link itself with the urchinTracker JavaScript if you would like to track these downloads. This piece of JavaScript assigns a pageview to any click on a link – the pageview is attributed to the filename you specify.
For example, to log every click on a particular link to www.example.com/files/map.pdf as a pageview for /downloads/map you would add the following attribute to the link’s tag:
a href=”http://www.example.com/files/map.pdf” onClick=”javascript:urchinTracker (‘/downloads/map’); ”
Important: if your pages include a call to urchinTracker(), utmLinker(), utmSetTrans(), or utmLinkPost(), your Analytics tracking code must be placed in your HTML code above any of these calls. In these cases the tracking code can be placed anywhere between the opening
tag and the JavaScript call.To verify that urchinTracker is being called correctly, you can check your Top Content report 24-48 hours after the updated tracking code has been executed. You should be able to see the assigned pagename in your report.”
More From pstilgoe



October 5th, 2006
