Track PDF Downloads With Google Analytics

Google Analytics now has ‘Event’ tracking functionality enabled (yes I realise I’m a bit late to the party here, its been a busy year) so you can track specific events that occur on your landing pages – for example the number of times a video is played or a file is downloaded.

So how do you track downloads of a free pdf you’re giving away exactly? Its really easy actually, once you dig past the usual Google support page. All you need to do is add an onClick event with a couple of parameters to whatever link you wish to track.

Note: Before you ask, you have to be tracking a link or whatever in a page you have the usual Google analytics snippet installed on for this to work.

In the example below, we will track the number of downloads a pdf file gets:

<p>Download A Sample Ebook FREE - <a onClick="javascript:_gaq.push(['_trackEvent','PDF','Download','YOUR-EBOOK-FILE-NAME.pdf']); void(0);"
href="HTTP://FULL-URL-TO/YOUR-EBOOK-FILE-NAME.pdf" target="_blank">
<b>Click Here ยป</b></a>
<br /><small>(Adobe PDF Format, XXmb)</small></p>

In the above [which you can paste into a page and use right now, you just need to change the Event 'labels', url and file name] we are using ‘PDF’ as the analytics category, and ‘Download’ as the action. The ‘your-ebook-file-name.pdf’ is the Event label. These three parameters are all that is needed to implement simple tracking of pdf downloads. The resulting stats are visible in your Google Analytics account under the ‘Event Tracking’ tab, which is cleverly hidden in the ‘content’ tracking section.

This is a very basic example but works like a charm, enabling you to easily track any downloads [not just pdf's either] from any page that has your Google analytics snippet installed on it. Obviously for your own purposes you only need the actual link part of the above, the rest is just fluff for the sake of example.

You can also use the above onclick event to track exit urls, whether they be external 3rd party links or internal ones. Simply set an event for a specific link or links, and you’ll know exactly where you traffic is going and what they’re clicking on.

Google Event tracking is massively more complex with a horde of features available – you can track user interactions with links in Flash for example, or track how many times the ‘stop’ button got hit on a video. The possibilities are fairly endless. You can read about all the paramters available to you in the Google support doc which is located below – (most of its pretty boring, this link is pretty well all the good stuff):

http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html

Like this post? Bookmark or share it:

 

Previous/Next posts:

Leave a Reply