Step by Step Guide: Track File Downloads on Your Website

December 2, 2019

Why use JumpStory?

Save time: We've curated the best images for you.

Save money: Unlimited use for just $23 per month.

Get the latest posts delivered to your inbox

Why use JumpStory?

- Save time:
  We've curated the best   images for you.

- Save money:

  Unlimited use from $23   per month.

Do you have a blog, publish whitepapers, or ebooks, and do you use images from Jumpstory as well? If you do, you probably already spend a lot of time producing content for your website. You might want to know how many users are downloading your content.

By tracking your downloads, you will be able to figure out what content your visitors like the most and adapt or improve your visuals accordingly. 

Google Analytics doesn’t do download-tracking “out-of-the-box”. In other words, you have to tell Google Analytics that you want to track this. There are various methods to do this. One of them, I will guide you through today, using Google Tag Manager.
In this post you will get a step-by-step guide to set up download tracking on your website, using Google Tag Manager and Google Analytics.

What is Google Tag Manager?

In short, Google Tag Manager is a one-stop for all of your tracking and scripts on your website. You can easily implement, test, pause, stop, and start new and existing tags, saving you time and money on developers.

Google Tag Manager is the industry standard for managing all the scripts and tags running on your website. If you haven’t migrated your tracking into Google Tag Manager, you seriously should consider doing this.

Tracking downloads using Google Tag Manager

Google Tag Manager is often my go-to tool for tracking everything on a website, and download tracking is no different. I prefer using GTM because tracking is easy and fast to set up, making it possible to test tracking before going live.

If you have set up Google Tag Manager on your website, all you need to do is:

  1. Active the built-in variable for clicks,
  2. set up a trigger, and
  3. attach the trigger to a Google Analytics event tag

Let’s dive straight into it.

1. Activate variables for clicks

The first step for tracking downloads is to activate the built-in variable for Click URLs. Like your blog, e-books, or whitepapers have a specific URL (i.e., we have to tell Google Tag Manager that we want to track these specific URLs or file extensions in the data layer.

To do this, you have to open Variables and enter Configure in Built-in Variables. Here you need to scroll down to find check of Click URLs. Once you’ve done this, you’re ready for the next step.

2. Configure your download-trigger in Google Tag Manager

So, now you’ve configured GTM to ‘know’ that you want to track Click URLs, next you have to create a trigger to fire on an event based on your file extensions.

To create a trigger, enter Triggers and enter New. Here, select the Just Links-click trigger. To configure the trigger, check off the boxes “Wait for tags” and “Check Validation”. Without going into too many technicalities, the checkboxes make sure that the trigger isn’t fired until the file is 100% downloaded.

Next, you want to enable this trigger when the page Page-URL ‘matches RegEx .*’. This makes sure, that your tag fires on all pages of your site.

Finally, you can configure the file extensions, which you want your trigger to fire upon. I started by stating that you can track downloads of e-books, images, or whitepapers, but if you want to track mp3-downloads from your podcast, you can do this as well; all you have to do, is to add the file extension to the trigger.

To tell the trigger to fire on these extensions, you have to type the following (.\pdf|jpeg|mp3). If you want to add more file extensions such as .gif, .png, and so on. Basically, just add more file extensions.

3. Configure your tag for Google Analytics

You’ve configured your built-in variable, and you’ve configured your trigger – now you want to connect the trigger to a Google Analytics event tag. With this setup, the trigger will record an event in Google Analytics every time a visitor downloads one of your images or e-books.

Under tags, create a new tag and select Google Analytics Universal Analytics. Next, select Event as a track type.

Under category, select a name that works best for you, but in this case, I’ve named it File Download. Under action, you can dynamically configure this to show every URL. This way, Google Analytics will show you exactly which URL – and thereby which file extension – the user downloaded.

If you haven’t set up any Google Analytics setting, you can  ‘Enable overriding settings in this tag’, and manually enter your tracking ID from Google Analytics here.

4. Check your new tag in Google Analytics

Once your tag is set up, Google Tag Manager will deliver the data to Google Analytics. To test your new tag, enter Real-time in Google analytics. Here, you can see all of your actions on your website in real-time.

Find one of your .pdf or .jpeg-files, open it in a new tab, and check if your new tag fires correctly. Once it does, you will receive an event in Google Analytics.


Google Tag Manager is a highly effective and valuable tool for your event- and conversion tracking. With this guide, you’ve come one step closer to taking advantage of the possibilities of GTM and Analytics.

About the author

Kasper Gregersen has worked with online marketing since 2012.

Today he is an independent consultant, specializing in Google Ads, as well as Facebook Ads, Google Analytics and tracking of websites.



Kasper Gregersen

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Want more?

Get 10 free, down-to-earth eBooks about marketing, visual communication and storytelling. Written by authors like Guy Kawasaki (Apple), Lars Fjeldsoe (Dropbox), Peter Kreiner (Noma) and more.

Want 25% off?

You're likely not ready to try our service right now. And that's alright.

How about we e-mail you a discount code for when you are?

We will of course also send you a brief explanation on what’s so special about us. And subscribe you to our regular newsletter, where you’ll be notified when we publish content like this page.

But don’t worry. We won’t share your address with anyone else. And it’s just one click, then you’re off our list again.