How to track PDF downloads using Google Tag Manager

What’s the best way to track PDF downloads on your website?

I’d recommend using Google Tag Manager to create a custom event, and then tracking the event in Google Analytics.

Click on the image below to download an example Google Analytics PDF

Google Analytics Report - PDF

The PDF should open in a separate tab.

Below I’ll show to track PDF downloads in Google Analytics using Google Tag Manager.

How to create a PDF download tag in Google Tag Manager

Click New Tag in Google Tag Manager.

How to track PDF downloads using Google Tag Manager

How to track PDF downloads using Google Tag Manager

Choose the tag type of ‘Google Analytics – Universal Analytics’.

Added in the following details to the tag. Choose your own Google Analytics tracking code.

By adding in {{Click URL}} as our Label, we will be able to track each unique PDF download on the website.

Create a trigger using the details below. Choose the Trigger Type ‘Click – Just Links’.

Just links clicks in Google Tag Manager.

Set up the trigger as shown in the image below.

For the Page URL you can use ‘matches Regex’ and .* to select all pages.

How to track PDF downloads using Google Tag Manager

For the Click URL, we can choose ‘ends with’ and ‘pdf’ so that the trigger works only with pdf downloads specifically.

How to track PDF downloads using Google Tag Manager

We have our ‘GA – PDF Download’ tag which is triggered by the ‘PDF Download Clicks’ trigger.

Testing out the tag using Google Tag Manager preview mode

Once we’ve set up the tag and the trigger, we can test out whether it’s firing.

Earlier in this blog post I clicked the PDF download image, as shown below.

How to track PDF downloads using Google Tag Manager

I could then see in the GTM preview mode that the ‘GA – PDF Download’ tag had fired.

Testing it out in GTM preview mode.

Confirming the events are appearing in Google Analytics

We can open up Google Analytics and look at Real-Time Events.

Google Analytics Real-Time Events

We see that under Events there has been a Download Event and the Event Label is our PDF URL. This confirms the GTM tag is firing correctly.

Checking if the tag is working in Google Analytics events.

Since we can see that the tag is working correctly and the data is appearing as we want it to in Google Analytics, we can go ahead and publish the latest workspace version in Google Tag Manager.

How to track PDF downloads using Google Tag Manager

Download Google Data Studio Templates

If you’d like to download one of my Google Data Studio reports as a template to use for your own data, you can visit Data Studio Templates and purchase one.

Google Data Studio Templates

My other GTM blog posts

If you liked this article you might like my other blog posts about Google Tag Manager.

Or you can follow me on Twitter!

I’m Michael


I’m a South African digital analyst living in Toronto, Canada. I blog about digital marketing, web analytics and data visualization.

Get in touch with me!
LinkedIn
Twitter
Email

Michael Howe-Ely