January 23, 2017

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

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

Subscribe to our Newsletter

Stay informed on the latest technology news and trends

Relevant Insights

Should You Disrupt Yourself to Accelerate Digital Transformation?

It has been interesting to watch Microsoft transition from a company that makes its money via licensing to one that...

Cybersecurity Myth Busted: Tools Are the Solution

When thinking about security, people often gravitate towards implementing various security tools, solutions, or products. If you bring up a...

Time to Reconsider MP-BGP EVPN for Your Datacenter Network?

VxLAN was defined in 2014 by RFC 7348 and has been used as a component in several SDN (software defined...