Step 1: Install Google Tag Manager on your website
- Click on ‘Admin’ in the main navigation
- Click on ‘Install Google Tag Manager’
- Copy the provided code and paste it in the <head> and <body> of your webpage
- 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
- Click on Variables in the left panel navigation
- Click Configure under the Built-In Variables section
- Ensure Click URL is checked under the Clicks section
- Activate the elements under Pages
Step 3: Create a Tag and Trigger
- Click on Tags in the left panel navigation
- Click NEW and name tag appropriately
- Configure your tag by clicking the edit pencil icon in the Tag Configuration section
- Choose Universal Analytics as your Tag Type
- Tracking ID (tracking ID from Google Analytics account): UA-xxxxxx-xx
- Tracking Type: Event
- Event Tracking Parameters –
- Category: PDF Click
- Action: Download of PDF
- Label: {{Click Path}} OR {{Click URL}
- Create the trigger by clicking the edit pencil icon in the ‘Triggering’ section
- Click +New to create your trigger and name appropriately
- Configure the trigger by clicking the edit pencil icon in the Trigger Configuration section
- Choose Just Links as your trigger type under the Click section
- Select Some Link Clicks
- Setup your rule with the dropdowns and text fields:
- Page Path contains .*
- Click URL contains .pdf
- Save the trigger
- Your trigger configuration will resemble this:
- Save the Tag
Step 4: Publish
Click the PUBLISH button in the top right to publish your event