How To Track PDF Downloads Using Google Tag Manager And Google Analytics 768x412 1

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:

Variables 1 768x381 1

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:

Pages 768x361 1

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

Configure Built In Variables Highlighted 1 768x360 1

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

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

User Defined Variables New 1

Under Page Elements, select Auto-Event Variable:

Click Path Auto Event Variable 1

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

Click Path 1 1

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 1

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

Trigger Type 1

Set up the trigger like this:

Pdf Click Tag 1

  • 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:

Tags New 1

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

New Pdf Click Tag Config 1

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”:

Choose Tag Type 1

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 1

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

Tag Configuration False Interaction 1

“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.

Blog Footer Cta1 1