Summary: Tracking PDF clicks through Classic or Universal Google Analytics alone can be tedious. However, if you track PDF downloads using both Google Tag Manager and Google Analytics, the task becomes easier and less susceptible to mistakes. 

Caveat: The steps outlined in this article cover only Classic or Universal Google Analytics. The article does not tackle Google Analytics 4.

If you have white papers, case studies, and other downloadable content, understanding how much traction you get from those collaterals is one of the key things you need to do as an online marketer. The ability to see PDF performance tells you which content is resonating with your audience, along with which stage of the marketing funnel the user is in.

Unfortunately, if you’re one of the millions of users of Classic or Universal Google Analytics (GA), that’s not one of the default features of the tool. You can technically add some scripts to each of the PDF links to track those with events on GA, but that’s both time-consuming and error-prone.

With some configuration, though, you can track PDF downloads using Google Tag Manager (GTM) and Google Analytics. This will allow you to get critical download data without manually adding scripts to each of your PDF links.

GTM to the Rescue: Track PDF downloads with Google Tag Manager

If you have Google Tag Manager or GTM running on your site, you can use firing conditions to track PDF clicks. (If you’re on the fence about adding GTM to your site, here’s our guide about whether or not Google Tag Manager is right for you.)

Not sure if Google Tag Manager is right for you? Read our guide.

“Should You Be Using Google Tag Manager?”

We’re keeping this as simple as possible, so more marketers can use it as a guide, but the truth is Google Tag Manager does introduce some measure of technical complexity.

Here’s the least you need to get familiar with:

  • Variables are the attributes you can pull data from, like click URLs.
  • Triggers are the conditions under which you’ll get scripts to fire. So for PDF tracking, you’ll need some way to tell the system to fire the tag if the URL contains “.pdf”.
  • Tags are the beating heart of GTM – they’re the things that fire when certain conditions are met. This allows you to do things like track PDF and mailto clicks, and add general scripts like those for web analytics and survey tools, etc.

For PDF tracking on GA and GTM, let’s start with the variables.

1. Configure the Variable Setup

You need to make sure a few variables are available for your trigger and tag later. Let’s start with the click variables.

Go to Variables in Google Tag Manager, and click Configure:

track pdf downloads google tag manager- google tag manager workspace with the variables screen displayed. screen has a configure button

Under  Pages, you’ll need Page Path to be active. But you might as well activate all the other Pages variables as well while you’re here:

 track pdf downloads google tag manager - configure built-in variables panel with the pages variables clicked and highlighted

Then, scroll down to the Clicks variables. Make sure all the elements under Clicks are active:

configure built-in variables panel with the clicks variables checkboxes ticked and highlighted

Finally, we’ll need a custom variable called Click Path.

Near the bottom of the variables section, create a new user-defined variable:

track pdf downloads google tag manager- variables screen scrolled down to display the user-defined variables section

Under Page Elements, select Auto-Event Variable:

user-defined variable configuration screen. choose variable type panel is active and auto-event variable is highlighted under page elements

In the Variable Type dropdown, choose Element URL. Then, select Path under Component Type.

user-defined variable configuration screen labelled as click path. variable type is auto-event variable, element url is picked for variable type dropdown, and path is selected under the component type dropdown

Once you save Click Path, you’re done with variables. Now it’s time to build the firing condition for PDFs.

2. Configure the Trigger Setup

Go to the Triggers section of GTM, and create a new trigger:

trigger configuration screen labeled as pdf click

Then, click Just Links under “Choose trigger type”:

 trigger configuration screen with choose trigger type panel. just links under click is highlighted

Set up the trigger like this:

trigger configuration labeled as pdf click. trigger type is set to click-just links, wait for tags is checked and set to 2000 milliseconds. check validation is checked and "enable this trigger when all of these conditions are true" is set to "page path - matches regex (ignore case) - .*" "this trigger fires on" is set to "some link clicks". and "fire this trigger when an event occurs and all of these conditions are true" is set to "click url - contains - .pdf"

  • Click – Just Links” tells the system that it should listen for clicks on all elements of the site.
  • Wait for Tags” and “2000” tell the system to wait 2 seconds to listen for the click, in case there’s a lag. Adjust the 2000 value as needed.
  • Page Path” and “.*” tell the system to enable listening for this trigger everywhere.
  • Click URL”, “contains”, and “.pdf” tell the system to wait for a PDF click to fire the trigger.

Name the trigger something that’s easy to remember, save it, and then move on to the tag.

3. Configure the Tag Setup

You’re almost there.

With the variables and the trigger out of the way, it’s time to configure the tag.

Go to the Tags section of GTM. From there, create a new tag:

track pdf downloads google tag manager- google tag manager workspace with tags selected

Label the category something easy to remember, like PDF Click. Then, click anywhere in the Tag Configuration area:

google tag manager - tag configuration screen labeled as pdf click

You’ll need to know which Google Analytics iteration you have: whether it’s Universal or Classic. Pick whichever one you have under “Choose tag type”:

track pdf downloads google tag manager- tag configuration with the "choose tag type" panel displayed

On the Tag Configuration screen …

  • Plug in “Event” under Track Type.
  • Add “PDF Click” under Category
  • Have the Action pull your custom variable, “{{Click Path}}” and add the tag you just created.

The whole tag should look like this:

tag configuration screen with google analytics: universal analytics selected as the tag type. track type is set to "event", category is set to "pdf click", and action is set to {{click path}}. under the triggering section, firing triggers indicates "pdf click - just links"

Let’s zoom in a bit on the configuration screen:

tag configuration screen with google analytics: universal analytics selected as the tag type. track type is set to "event", category is set to "pdf click", action is set to {{click path}}, and non-interaction hit is set to "false"

“PDF Click” and “Click Path” have been explained above, but the “False” value under “Non-Interaction” tells the system to treat clicks to PDFs pretty much the same way pages are treated. That is, if people land on your page then click on a PDF, that interaction will not register as a bounce – that’s pretty important if you want bounce rate to be accurate.

Save the tag, publish the changes, and you’re done.

PDFs will start showing up as events on Google Analytics.

Tracking PDF downloads with Google Tag Manager: Somewhat Technical, But Powerful

Google Tag Manager isn’t for everyone.

And it is a somewhat technical tool. You can certainly get away with doing basic stuff like adding the GA code on your site without developer-level knowledge. However, to get the most out of the tool, you’ll either need to pick up some script skills, or have a developer on hand to consult with.

That said, it’s not like GTM is a tool you’ll constantly be tweaking. PDF tracking is a pretty good example of GTM being a setup-and-forget mechanism – you’ll have to do some heavy-lifting, but you’ll only have to do it once.

If you have the technical knowledge in-house to attempt the steps above, you’ll be able to increase visibility for good, without adding a penny to your tools budget.

This post was originally published in November 2016 and has been updated to reflect the interface of Google Tag Manager in 2020.