Tracking PDF Downloads in Google Analytics

- August 5, 2009

PDF Files are no doubt a part of your website. Sure, they’re not HTML, PHP, or ASP pages, but they are files that contain information that is just as valuable as any other page on your website. So, why not track PDF files in Google Analytics, too?

At MoreVisibility, we see a lot of websites out there using Google Analytics that are not tracking their PDF Files as either pageviews or events – both of which are possible to do. The best part about it is that it’s very easy to configure, which is good news for any person on your IT / technical team.

To track any PDF file on your website, simply follow the quick steps below and you’ll be well on your way. It gets a bit technical from here on out, so roll up your sleeves and put your hard hats on.

1. Find a page that links to one of your PDF files.

2. Find where the PDF file is on the page – look for the anchor (<a>) tag. It should look something like this:

<a href="files/quarterly-earnings.pdf" target="_blank">Quarterly Earnings Report</a>

3. Insert the following “onClick” event within this anchor tag. It should look like this:

<a href="files/quarterly-earnings.pdf" target="_blank" onClick="pageTracker._trackPageview('/files/quarterly-earnings.pdf');">Quarterly Earnings Report</a>

4. Upload the page and enjoy the results! You should see the number of times that your PDF file was accessed within the Content >> Top Content section of your Google Analytics profile.

Tracking a PDF Download as an Event (vs. as a Pageview)
To track your PDF Downloads as Events, simply use the _trackEvent function instead of the _trackPageview function, like so:

<a href="files/quarterly-earnings.pdf" target="_blank" onClick="pageTracker._trackEvent("PDF Files", "Downloads", "Quarterly Earnings Report", "500");">Quarterly Earnings Report</a>

(Learn all about Event Tracking with my latest blog post from last week)

The activity that occurred on your PDF Files will be within the Event Tracking section, which is a sub-section of the Content section of reports, instead of in the Top Content report.

Is there a difference between tracking PDF files as Pageviews or as Events?
Other than the obvious fact that one way will count them as a pageview, while the other way will count them as an event, the biggest difference between the two is the ability to track Goals. As of today, Google Analytics does not have the ability to track Events as Goals, so if you were planning to track all PDF downloads as Goals, you will need to track them as Pageviews, and not as Events. Advanced Segments are now available for Events, but they are not the same as Goals.

So what are you waiting for? Grab your webmaster and start tracking your PDF files with Google Analytics!

Comments are closed at this time.

© 2017 MoreVisibility. All rights reserved