Tracking PDF downloads with Google Analytics

Posted by on Jul 11, 2012 in HTML5 | No Comments

By default, there is no way of tracking document downloads – such as PDF’s – in google analytics.  Google Analytics works by sending some information back to google whenever someone lands on a web page.  But of course, a document download is not a ‘page’ in the traditional sense – so we need to find an alternative.

Fortunately, google provides a simple ‘event tracking’ mechanism which allows you to assign a page view to an event – such as an ‘onclick’ event.  The code example below shows a regular link to a PDF file, followed by the same link with google tracking enabled:

Keep up to date: sign up to our infrequent newsletter …





I'm launching a new blog ... and a book (shhh ... it's not official yet!) check it out here