Tracking file downloads in Google Analytics

//, Search Engine Optimisation (SEO)/Tracking file downloads in Google Analytics

Tracking file downloads in Google Analytics

WebSanity Internet Marketing logo
If you use Google Analytics to track website visitor traffic, then you might be missing valuable statistical information about the number of times that any PDFs you have on your site are downloaded. Google’s Analytics works by installing tracking code in all HTML files, but PDFs can’t have this code attached to them.

However, there is a way to get this information by putting some simple code on the links to the download files.

As an example, your initial link might be as follows:

<a href="http://www.websanity.co.uk/web-design-cambridge.pdf">Web design in Cambridge</a>

By adding a little bit of Javascript (shown in red), you can have all clicks to download the file appearing under the pagename you have picked:

<a href="http://www.websanity.co.uk/web-design-cambridge.pdf" onClick="javascript: _gaq.push(['_trackPageview', '/downloads/web-design-cambridge']);">Web design in Cambridge</a>

Finally you can track just how effective your downloads are in practice!

NOTE: Not only can you use this to track downloads, you can also use this to track key links that people click on within your site to leave it e.g. to partners, useful links etc.

2011-04-22T19:01:00+00:00April 22nd, 2011|News, Search Engine Optimisation (SEO)|