We can’t track PDF document views in Google Analytics but this doesn’t mean we can’t track when users download them from our site. By doing so, we’ll get to know if users at least downloaded our PDF files and if they did, for how many times and from which page.
This is not the same as knowing if users actually read the document, but it’s still better than not knowing anything at all about the PDF documents usage.
Implementing the Google Analytics PDF download tracking is super easy with Google Tag Manager (you don’t have to be a Google Tag Manager expert for this) so in this tutorial, we will use this method to implement the tracking.
Creating the GTM tag
Since we are going to track the PDF downloads as events in Google Analytics, we need to create an Event type tag in Google Tag Manager. In the event category field, we can write “PDF downloads”, in the event action we will add the “Click URL” built-in variable and in the event label we will add the “Page Path” built-in variable.
In this way, when the event will be sent to Google Analytics, the event category will be “PDF downloads”, event action will be the PDF file’s filename and the event label will be the page path where the user downloaded the document.
After configuring the tag, we can name it as “GA – Event – PDF Download tracking” and select our GA settings variable in the “Google Analytics Settings” field.
Creating the tag trigger
Now that we have our tag ready, we need to add a trigger to it which should fire when a user clicks on a link with a PDF extension. For this, when creating the trigger, we should choose a “Click – Just Links” trigger type and as a condition, we should set it to fire when the “Click URL” variable ends with “.pdf”.
Once created, we need to assign this trigger to the tag created earlier and test it.
Testing the PDF download tracking
The first thing to do when testing the tag is to enable the “Preview and debug” mode in GTM by clicking on the “Preview” button from the top right corner.
After this, we can open a page on our site where there is a link to download a PDF file and click on it. If the tracking was installed correctly, we should see the tag “GA – Event – PDF Download tracking” fire in the “Preview and debug” console that loaded on the page.
And to confirm that the event was truly sent to Google Analytics, we should check the “Events” section from Google Analytics’s “Real Time” report, where our event should show up.
Creating a goal in Google Analytics
Depending on what you are measuring as a conversion, you might want to create a goal if a specific PDF document is downloaded. In this way, you will know which traffic source or campaign generates more PDF downloads and which one is performing worse for this purpose.
To create a goal, in the Admin section from Google Analytics, we need to go to View/Goals and click on “New Goal”. As the goal type we need to select “Event” and on the next step, in “Event Category” field, we should enter “PDF downloads” while in the event action field, you need to enter the path of the PDF document you want to track. In this example I left it blank as I want this goal to track all PDF downloads.
With this goal, your PDF download tracking should be ready so the only thing remained to do is to publish the changes in GTM.
Now you can start analyzing the newly collected data in the Events reports from your Google Analytics account or you could use a tool like KPIBees to import the data in Google Spreadsheet for a more granular analysis.
If you have any question regarding this tracking, ask us it in the comments below. Alternatively, if you need help with other Google Tag Manager or Google Analytics task, you can send us a message and our experts will help you with your task/question.