How to track PDF downloads using Google Tag Manager

Google Tag Manager PDF downloads

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

How to track PDF downloads using 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.

On this blog post I clicked the PDF download image.

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.

How to track PDF downloads using Google Tag Manager

Confirming the events are appearing in Google Analytics

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

How to track PDF downloads using Google Tag Manager

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.

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
Michael

Author Michael

More posts by Michael

Leave a Reply