Track PDF Downloads in Google Tag Manager
There are a few ways to track PDF Downloads in Google Tag Manager. However, for this example, I would like to use a click listener method. We will generate an event each time someone clicks a PDF link. Tracking the actual download isn’t necessary because many people will simply view the PDF file in the browser.
Click the link the below to see how a PDF is displayed the browser.
First you will need to Open up Google Tag Manager and create a trigger and tag. We will use Google Analytics as our tracking platform. However, please feel free to use others. Lets get started with the Tag creation.
Create a Google Analytics Tag
- Choose Tag, Choose New
- Name Your Tag
- Choose Google Analytics Tag, Use Universal Analytics
- For Track Type, Choose Event
- Name Your Event Category and Action
- For Label Choose Page Path or Page URL to know how users reach the pdf.
- For the moment, leave Fire On blank, we will create a trigger to add to the tag.
- Create the Tag
- Choose Triggers
- Click New
- Name your Trigger
- For Event, Choose Click
- Configure the Trigger by choosing, Just Links for targets
- Leave the standards settings of Wait for Tags & Max Time to Wait
- Under Enable When, you want to enable this on all pages by choosing Page URL contains (.*) If you want to track on a specific URL please indicate.
- For Fire On, chose the Click URL, since you know this is a PDF, we can use the \.pdf$ to indicate that we only want to track PDFs.
Attach the Trigger to the Tag.
- Open up your previously created PDF download tag, under Fire ON, choose Click.
- Add the trigger that you previously made to the Tag and Save.
- Click Preview and Debug Mode
- Go to your website and click the PDF download link
- See if the Tag is fire in the Debug Console.