Track PDF Downloads With Google Analytics

Taken from here: http://www.cre8ivespark.com/track-pdf-downloads-with-jquery

In the past, it has often been an extensive process to track PDF downloads with Google Analytics. Usually, you would need to add event tracking to every PDF file on a website in order to track the number of downloads.

Some companies have spent quite a lot of money to organise a custom script or process in order to add tracking to each document download link on their website.

However that has all changed now! With the jQuery script below, you can now easily add tracking to every document of your choice. You could track Word docs, PDF docs and more.

The jQuery Script

<pre>    $("a[href$='pdf']").each(function(index) {
      pdfLabel = $(this).attr('href');
      pdfOnClick = "_gaq.push(['_trackEvent', 'PDF', 'Download', '" + pdfLabel + "']);";
      $(this).attr("onClick", pdfOnClick);
    });</pre>

How To Find The Results In Google Analytics

When you login to Google Analytics, you can track the downloads through the event tracker with the following steps:

  • Click on -> Standard Reporting
  • Click on -> Content
  • Click on -> Events
  • Click on -> Overview
  • Click on the event category (i.e. ‘PDF’)
  • Add the following secondary dimension: ‘Event Label

Revisions

Tags:

No comments yet.

Leave a Reply