The web agency that excels at finding smarter ways to
improve your website and online marketing. Here's how


How to Track Word and PDF Downloads in Google Analytics

By Josh  |  March 14, 2013  |   How To | Online Marketing

Tracing Downloads with Google Analytics

Note: The method outlined below is for use with ga.js tracking code and not for use with the analytics.js tracking code. For details regarding Event Tracking with analytics.js see Google's Documentation.

Straight out of the box, Google Analytics does a great job of tracking your web pages.

Unfortunately, Google Analytics doesn't automatically track file downloads (such as PDFs, Excel spreadsheets, PowerPoint files and Word docs).

The great news is that getting Google Analytics to track downloads doesn't take a whole lot of effort on your end.

To track file downloads we recommend using Google Analytic's Event Tracking.  Let's look at how you can use Event Tracking to begin tracking your own website's downloads today.

The download link


  1. Basic HTML knowledge: you should understand the basic anatomy of a standard HTML link.
  2. You must be able to edit the HTML of the web page containing the link to your file download.

Let's jump right into an example.

Let's assume we have a PDF I'd like to offer as a free download on our site, and let's say the filename of the offer is RecipesForDogs.pdf.  I want to track how many people download this PDF from our website.

So, to start off, I first create a simple link to my file on one of our web pages.  The link would look something like this:

<a href="/RecipesForDogs.pdf">Download My Great Recipe Book for Dogs</a>

This is just a basic HTML link to the PDF file that's been uploaded to our server. Nothing fancy here.

To start tracking downloads, I'll  need to add what's called an event handler to the link — like so:

<a href="/RecipesForDogs.pdf" onClick="_gaq.push(['_trackEvent', 'Offers', 'Download', 'Dog Recipe Book Offer']);">Download My Great Recipe Book for Dogs</a>

In the above link, I've added an onClick event handler (in bold). This event handler is where I'm asking Google Analytics to track clicks on this link as an Event. 

Don't worry if this seems complicated to you; all you'll need to do is copy the code above and modify a few parts to match your needs.  

Let's look at how you'd do this.

Customizing this code for your own website

First, you'll need to modify the href attribute in the code I've provided so it points to the specific file on your server that you wish to track. (I'm going to take a wild guess and assume you're not trying to track a PDF on your server named RecipesForDogs.pdf.)

Modify the Event Category

After you've got the link pointed at the file you'd like to track downloads for, you'll want to tweak the Category.Category for Event Tracking

In the example above, I categorized the  Recipes for Dogs PDF in an "Offers" category. Especially helpful when you offer many different types downloads on your website (like Ebooks, free reports, questionnaires, etc.), the Categories you choose are what will allow you to logically and intuitively sort through all your downloads data when you review it in Google Analytics.

You can create as many Categories as you'd like and give the Categories any names you like; it's completely custom and based on how you'd like to organize and think about your data.  

Once you figure out what Category you'd like to use for your download, swap that out with my "Offers" Category in my example.

Modify the Event Action

After specifying the Category of your download, you'll next want to configure the ActionAction for Event Tracking

In my example (above), the Action is "Download".  The Action is simply your description of what the user is doing when she clicks this link.

(When tracking downloads, the obvious Action to specify would be "Download", but keep in mind Event Tracking can actually be used to track all types of interactions, including form submissions, videos played, pop-ups clicked, etc.)

Modify the Event Label

Finally, give your download a LabelLabel for Event Tracking

In our example the Label is "Dog Recipe Book Offer". This is just the name that Google Analytics will use when displaying this specific download in its reports. Just as with the Category and Action, it can be whatever works for you.

That's it.Event Menu in Google Analytics

Once this code is live on your site, Google Analytics will automatically track your file downloads. 

To view your results and see if/how your website visitors are downloading your files, just go to Content > Events within Google Analytics. (Make sure to give Google Analytics at least 24 hours to begin tracking and displaying the data after you've tagged your download links).

To learn more about Event Tracking, visit Google's Event Tracking Documentation.

Happy tracking!

Note: The method outlined above is for use with ga.js tracking code and not for use with the analytics.js tracking code. If you're not sure which one you're using, chances are it's the ga.js. For details regarding Event Tracking with analytics.js see Google's Documentation.


Get an email when our next post comes out! Sign up now