I have a number of sites where brochures are available for download. It struck me that tracking the downloads could provide valuable marketing information to my customers. I thought this would be a simple task, and in fact it is, however it took me some time to find out how to do it.
I thought it might be worth sharing the approach I used in the hope that it saves someone else a little time.
In this case I am assuming that Google Analytics is being used. The first step is to check which version of the tracking code is in use. If it is the legacy code (urchin.js), then this will need to be replaced with the new code (ga.js), if this approach is to work.
Google Analytics does not track PDF files by default, however this can be overcome by changing the download link on your web pages so that it is seen as a virtual pageview. To do this scan through the source code to find the link for the download, it will look something like this:
<a href=”mybrochure.pdf”>Download my Company Brochure PDF</a>
Replace this link with the following new link which will track the file in the /downloads directory:
<a onclick=”pageTracker._trackPageview(’/downloads/mybrochure.pdf’);” href=”downloads/mybrochure.pdf”>Download my Company Brochure PDF</a>
You will now be able to track the downloads in the Content section of Google Analytics.
Your comments and tips on any similar techniques are very welcome.