Skip to content
Downloads onto computer
Justin AtkinsonMar 29, 2016 12:00:00 AM2 min read

Google Tag Manager - How Can I Track Digital Downloads?

Tracking website resource downloads (ie. tracking PDF downloads, whitepaper downloads, statistical reports) allows the Google Analytics Administrator(s) to track the frequency and capacity at which users are downloading documents/files off your site. This enables you to prove ROI for the financial and physical resources invested in your site materials.

To track downloads using Google Tag Manager, you must create a new “Variable” for this Tag. This variable enables the file extension to appear in the Google Analytics reporting dashboard. Navigate through the following steps to create your new, custom variable.

Implement a custom variable to track digital downloads as follows:

  • First, log into your Google Tag Manager account and select the appropriate Container name.
  • To create your new Variable, click the “Variables” label in the left column of your screen and select “New” under the defaulted built-in variables.

GTM_Downloads_1.jpg

Next you must define the new variable by following the steps below:

  • Name your variable: Filetype
  • Choose your variable: Custom JavaScript
  • Configure variable: Please place the Custom JavaScript (Documented from: Laura Hornbake / May 20, 2014 / “Google Tag Manager Guide: Step-by-Step Tutorial for Event Tracking Part 2”) below into the box to create your Custom Variable.
    • function() {
      var ext = .pathname.split(".");
      return ext.length>1?ext.pop():'html';
      }

GTM_Downloads_2.jpg

 

Create a new Trigger:

Create the “Trigger” that will execute the “Tag,” which we will set up shortly.

  • Click the “Triggers” label in the left column of your screen and select “New.”

GTM_Downloads_3.jpg

Fill out the “Edit Trigger" fields as follows:

  • Name your trigger: Resource Download - Click (feel free to add your company name if you want)
  • Choose Event: Click
  • Configure your trigger:
    • Targets: Just Links
    • Max wait time:  2000 
  • Enable When:
    • Page URL
    • Contains
    • Insert your domain
  • Fire On:
    • Click Element
    • matches RegEx (Ignore case)
    • ^.*\.(7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip)$

Then, click "Save Trigger."

GTM_Downloads_4.jpg

Create a new Tag:

Finally, create a new “Tag.” Click the “Tags” label in the left column of your screen and select “New.”

GTM_Downloads_5.jpg

Fill out the “Tag” fields as follows: Choose your tag: Google Analytics

  • Name your tag: Resource Download - Click (feel free to add your company name if you want)
  • Choose Product: Google Analytics
  • Choose a Tag Type: Universal Analytics
  • Configure your Tag:
    • Tag Type: Universal Analytics
    • Tracking ID: Enter your Universal Analytics ID here
    • Track Type: Event
    • Category: Resource_Download - Click
    • Action: 
    • Label: (feel free to swap this variable out with , , etc...whatever makes the most sense for you and your company.
  • Fire On:
    • Click: Resource_Download – Click

Then, click "Save."

GTM_Downloads_6.jpg

After you click “Save,” your “Tags” dashboard appears. As a finishing touch, select “Publish” to ensure that your work is applied to your site.

GTM_Downloads_7.jpg

…And that’s it! You’re done!

If you have any additional questions, please don't hesitate to note your comments below and we will follow up as soon as possible.

For more information on how Brightfind can help you use data to continuously test, analyze, and improve your website - check out our Experience Insight service offering.

RELATED ARTICLES