January 23, 2017

How to track PDF downloads using Google Tag Manager and Google Analytics

Post by: Melanie Lenaghan

(Updated 12/12/19)

Many websites offer marketing resources such as whitepapers or reports to be downloaded. These resources often come in the form of a PDF.  In many cases, it is helpful from a marketer’s point of view to track these downloads. They can make marketing decisions based off interest in the resource’s content. Google Analytics tracks page views through a tracking pixel on an HTML page. Tracking a PDF download works a bit differently since a PDF file cannot request a tracking pixel. Luckily, with the help of Google Tag Manager there is an easy way to track this information. Once you get logged into Google Tag Manager you can follow these steps. (See our software development solutions)

Step 1: Install Google Tag Manager On Your Website

  1. Click on ‘Admin’ in the main navigation
  2. Click on ‘Install Google Tag Manager’
  3. Copy the provided code and paste in the <head> and <body>

Step 2: Enable Pre-Built Variable for Clicks

  1. Click on ‘Variables’ in the left panel navigation
  2. Click ‘Configure’ within the ‘Built-In Variables’ section
  3. Ensure ‘Click URL’ is checked under the ‘Clicks’ section

Step 3: Create a Tag and Trigger

  1. Click on ‘Tags’ in the left panel navigation
  2. Click ‘NEW’ and name tag appropriately
  3. Configure your tag by clicking the edit pencil icon in the ‘Tag Configuration’ section
    1. Choose ‘Google Analytics: Universal Analytics’ as your tag type
    2. Tracking Type: Event
    3. Event Tracking Parameters:
      1. Category (Category you would like your action organized under): Resource Download
      2. Google Analytics Settings: UA-XXXXX-XX
      3. Action (The action of the event itself): Download of PDF
    4. Label (detailed information on the event): {{Click Text}}
    5. Your tag configuration will resemble this: 
  1. Create the trigger by clicking the edit pencil icon in the ‘Triggering’ section
    1. Click ‘+’ (New) to create your trigger and name appropriately
    2. Configure the trigger by clicking the edit pencil icon in the ‘Trigger Configuration’ section
      1. Choose ‘Just Links’ as your trigger type under the ‘Click’ section
      2. This trigger fires on: Some Link Clicks
      3. Setup your rule with the dropdowns and text fields: ‘click URL’ ‘contains’ ‘.pdf’
      4. Save the trigger
      5. Your trigger configuration will resemble this:
  1. Save the tag

Step 4: Publish

  1. Click the ‘Publish’ button in the top right to publish your event

Now that your click event is setup you can test to ensure it is working properly. Open two windows in your browser. One for your live site and the other for your Google Analytics account. Click on the PDF download on your live site to trigger the event. Navigate to the Google Analytics window and click on ‘Real time events’. Here you will see the event tracking analytics.

Hopefully these instructions will be helpful for your marketing efforts.

Relevant Insights

5 Steps to Reduce Your Ransomware Risk

As the recent ransomware attack on the U.S.’s second-largest meat producer, JBS, made clear, cyberattacks on critical infrastructure can cause...

How to Unlock the Organizational Value of Digital Transformation

As organizations look to stay competitive in today's dynamic and unpredictable marketplace, a trend has re-emerged that is ushering us...

When Is Your App Too Complex for Power Apps?

When Microsoft first launched Power Apps and Power Automate, these apps were positioned to replace legacy SharePoint on-premises functionality such...