How to track PDF downloads with Google Tag Manager

Author:

Tracking PDF downloads on your website is essential to understanding user engagement with your content. Google Tag Manager (GTM) simplifies this process by allowing you to set up tags and triggers to capture these interactions and send the data to Google Analytics (GA). Here’s a step-by-step guide to track PDF downloads using GTM.

 1. Set Up Google Tag Manager and Google Analytics

  1. Create GTM and GA Accounts:
    • Ensure you have a GTM account and a container set up for your website.
    • Ensure you have a GA account with the tracking code implemented on your website.
  2. Link GTM to GA:
    • In GTM, create a GA tag to link your GTM container to your GA property:
      • Go to “Tags” > “New” > “Tag Configuration”.
      • Select “Google Analytics: Universal Analytics”.
      • Choose “Page View” as the track type.
      • Enter your GA Tracking ID.
      • Set the triggering to “All Pages”.
      • Save the tag and publish the container.

 2. Enable Click Variables

  1. Enable Click Variables in GTM:
    • Go to “Variables” in the GTM interface.
    • Click “Configure” in the “Built-In Variables” section.
    • Check the boxes for all click variables, including “Click URL”, “Click Text”, “Click ID”, etc.

 3. Create a Trigger for PDF Downloads

  1. Create a New Trigger in GTM:
    • Go to “Triggers” > “New” > “Trigger Configuration”.
    • Select “Click – Just Links” as the trigger type.
    • Under “This trigger fires on”, select “Some Link Clicks”.
    • Configure the trigger to fire only when the Click URL ends with “.pdf”:
      • Click URL → ends with → .pdf
    • Name the trigger “PDF Download Trigger” and save it.

 4. Create a Tag to Track PDF Downloads

  1. Create a New Tag in GTM:
    • Go to “Tags” > “New” > “Tag Configuration”.
    • Select “Google Analytics: Universal Analytics”.
    • Choose “Event” as the track type.
  2. Configure Event Tracking Parameters:
    • Category: PDF Download
    • Action: Click
    • Label: {{Click URL}}
    • These parameters will appear in GA and help you identify the events. Using {{Click URL}} dynamically captures the URL of the clicked PDF.
  3. Set the Trigger for the Tag:
    • Under “Triggering”, select the “PDF Download Trigger” created in Step 3.
    • Name the tag “GA – Event – PDF Download” and save it.

 5. Test the Setup

  1. Use GTM Preview Mode:
    • Click on “Preview” in the GTM interface to enter preview mode.
    • Navigate to your website and click on a PDF link.
    • Check the GTM preview pane to ensure the tag is firing correctly.
  2. Verify in Google Analytics:
    • Go to GA > “Real-Time” > “Events” to see if the PDF download events are being tracked.
    • Verify that the events are being recorded with the correct category, action, and label.

 6. Publish the Changes

  1. Publish the GTM Container:
    • Once you have tested and confirmed that the PDF download tracking is working correctly, publish the GTM container to make the changes live:
      • Click on “Submit” in GTM.
      • Add a version name and description for the changes.
      • Click “Publish”.

Example Scenario: Tracking PDF Downloads on a Blog

Objective: Track downloads of PDF files linked on a blog.

  1. Set Up GTM and GA:
    • Ensure GTM container and GA tracking code are implemented on the blog.
  2. Enable Click Variables:
    • Enable click variables in GTM.
  3. Create Trigger:
    • Create a trigger to fire on clicks where the Click URL ends with “.pdf”.
  4. Create Tag:
    • Create a GA event tag with:
      • Category: PDF Download
      • Action: Click
      • Label: {{Click URL}}
    • Set the trigger to the previously created “PDF Download Trigger”.
  5. Test and Publish:
    • Use GTM preview mode to test by clicking PDF links on the blog.
    • Verify the events in GA real-time reports.
    • Publish the GTM container once confirmed.

Tracking PDF downloads with Google Tag Manager involves enabling click variables, creating a trigger for PDF link clicks, setting up a GA event tag, and testing the configuration before publishing. This process allows you to capture and analyze user interactions with downloadable content, providing valuable insights into content engagement. By following these steps, you can effectively track PDF downloads and enhance your understanding of user behavior.