How to track Excel file downloads in Google Analytics using Google Tag Manager

How to track Excel file downloads in Google Analytics using Google Tag Manager

In this post I’ll show how to setup a tag to track Excel file downloads in Google Analytics.

The first step is to open up your Google Tag Manager container and add a New Tag.

Setting up the Tag

Let’s start by setting up the Tag Configuration.

We will choose the Google Analytics – Universal Analytics tag type.

For the Track Type we will choose Event.

We can set up our Event tag in the following way;

  • Category = Download
  • Action = Excel Download
  • Label = {{Click URL}} (This will list the file name as the Event Label in Google Analytics).
  • Google Analytics settings: choose your own GA tracking code variable.

Setting up the Trigger

The next step is to set up the Triggering.

We will need to create a new trigger, so click the plus sign that is listed as ‘New trigger’.

For the trigger type, we’ll choose ‘Just Links’.

We can name our Trigger ‘Excel file Download’ and choose the following conditions to fire the trigger;

Click URL > ends with > .xlsx

This will cause the trigger to fire whenever the file URL ends with .xlsx. You can also choose to add in other Excel variations, such as .xls or .xlsm.

Now that we have our Tag Configuration and Trigger set up we can name the tag ‘GA – Excel file Download’ and save it.

Testing out the Tag

Let’s test and make sure the tag is working correctly. For us to do this we can click ‘Preview’ in Google Tag Manager.

We can also click Refresh to make sure we are previewing the most up-to-date GTM version.

The next step is to download the Excel file you want to track.

The tag should fire and be displayed in the GTM preview screen, as shown below.

This confirms that the tag is firing correctly.

Confirming that the Event is showing up in Google Analytics

The next step is to make sure the correct events are being shown in Google Analytics.

Open Google Analytics and go to Real-Time > Events.

You can download the Excel file again, and we should see the following in GA;

Event Category = Download
Event Action = Excel download
Event Label = [Excel file name]

Publishing the Tag in Google Tag Manager

Now that we’ve made sure the tag is firing in GTM, and the event registering in GA we can publish our updated GTM version with our new tag.

Thanks for reading, and hope it was useful!

Update: Thank you to Google Analytics for sharing this Post!


Author Michael

More posts by Michael

Leave a Reply