Understanding your website (Part seven)

Tracking downloads. A common Goal of many websites is to get a user to a location  and then get them to download a file, say a PDF whitepaper or even watch a certain video. You can normally track this by manually looking at the files downloaded and finding the filename to calculate the number of hits it had. This can become a problem when you use reporting software like Google Analytics, which does not read your logs but instead reads a line of code embedded in each page. The good news is that if you are a Google Analytic user, there is a way around this.

You can simply tag the link that leads to the download with a specific piece of javascript code. This script creates a phantom pageview that you can now track.

For example, to log every click on a particular link to www.yoursite.com/form/reimbursement.pdf as a pageview for /downloads/map you would add the following attribute to the link’s <a> tag:

<a href=”http://www.example.com/form/reimbursement.pdf.pdf” onClick=”javascript:urchinTracker (‘/formdownloads/reimbursement’); “>

You can now see how many hits “formdownloads/reimbursement” received.