How to track PDF downloads using Google Tag Manager – Step by step guide

Step 1: Install Google Tag Manager on your website

  1. Click on ‘Admin’ in the main navigation
  2. Click on ‘Install Google Tag ManagerGoogle Tag Manager - Admin Console
  3. Copy the provided code and paste it in the <head> and <body> of your webpageGoogle Tag Manager - Code
  4. After setting up your Tag Manager account, you need:
    • Variable: click URL
    • Trigger: Something that tells the system to fire the tag if the URL contains .pdf
    • Tag: It fires when certain conditions are met, allowing you to do track PDF downloads

Step 2: Enable pre-built variable for clicks

  1. Click on Variables in the left panel navigationTag Manager - Variables - Clicks
  2. Click Configure under the Built-In Variables section
  3. Ensure Click URL is checked under the Clicks section
  4. Activate the elements under Pages

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 Universal Analytics as your Tag Type
    2. Tracking ID (tracking ID from Google Analytics account): UA-xxxxxx-xx
    3. Tracking Type: Event
    4. Event Tracking Parameters –
      1. Category: PDF Click
      2. Action: Download of PDF
      3. Label: {{Click Path}} OR {{Click URL}Tag Configuration
      4. 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. Select Some Link Clicks
          3. Setup your rule with the dropdowns and text fields:
            1. Page Path contains .*
            2. Click URL contains .pdf
          4. Save the trigger
          5. Your trigger configuration will resemble this:Tag Manager - Trigger Configuration
      5. Save the Tag

Step 4: Publish

Click the PUBLISH button in the top right to publish your event