How to Measure File Downloads in Google Data Studio
In this post I’ll show a method to measure file downloads in Google Data Studio. To be more accurate, I’ll show how to track file downloads in Google Tag Manager and how to monitor and measure the types of file that have been downloaded in Google Data Studio.
Below are examples of files you can download. Click on any of them if you like.
- Excel: Lorem-ipsum.xlsx
- Excel: Lorem-ipsum.xls
- Word: Lorem-ipsum.docx
- PDF: Lorem-ipsum.pdf
- Text: Lorem-ipsum.txt
- PNG: Lorem-ipsum.png
- Powerpoint: Lorem-ipsum.pptx
Below is a Data Studio report that shows the number of downloads for each file type. I’ll go through the steps needed to track these downloads in Tag Manager as well as display them in Data Studio.
How to track File Downloads using Google Tag Manager
I based this method of tracking file downloads on this video from Metric Mogul and taking a look at blog posts from Simo Ahava.
Start off to creating a new tag.
You’ll then need to click on Tag configuration.
And choose the Google Analytics – Universal Analytics tag type.
I’ve set up the tag in the following way;
Track Type = Event
Category = Downloads
Action = Downloaded File
Label = {{Click URL}}
And choose your Google Analytics tracking ID variable.
The next step is to create the Trigger to go with this tag.
Click to configure the trigger and then choose Click > Just Links.
Use the following setup for the trigger;
Click URL
matches Regex
\.(pdf|xlsx|xls|doc|txt|png|docx|ppt|pptx)$
You can add in any other document file extensions that you may need to track.
We now have our Tag which I will name GA – Downloaded File.
Making sure the tag is working using Google Tag Manager
Once we’ve created our tag and trigger, the next step is to make sure it’s firing correctly. To do this we can first check using GTM’s preview mode. Click on Preview and then go to a page with a downloadable file on it.
Click to download a file and you should see your tag fire, as shown below.
Making sure the tag is working using Google Analytics
Another way to make sure that the correct information is being sent to Google Analytics. Open GA and navigate to Real-time > Events.
You can then downloaded the file from your website a few more times. If it’s set up correctly you should see your files appearing under Events.
Now that we’ve confirmed the file downloads are being tracked properly, we can set up a report to monitor the downloads in Google Data Studio.
Building a report to track File Downloads in Google Data Studio
Choose Google Analytics as your data source and add it to your report.
Click on Add a Field and then use the following CASE statement. This will create a new Dimension based on file type.
CASE
WHEN REGEXP_MATCH(Event Label, ".*pdf") THEN "PDF"
WHEN REGEXP_MATCH(Event Label, ".*xls") THEN "Excel"
WHEN REGEXP_MATCH(Event Label, ".*xlsx") THEN "Excel"
WHEN REGEXP_MATCH(Event Label, ".*doc") THEN "Word"
WHEN REGEXP_MATCH(Event Label, ".*docx") THEN "Word"
WHEN REGEXP_MATCH(Event Label, ".*txt") THEN "Notepad text"
WHEN REGEXP_MATCH(Event Label, ".*png") THEN "png"
WHEN REGEXP_MATCH(Event Label, ".*ppt") THEN "Powerpoint"
WHEN REGEXP_MATCH(Event Label, ".*pptx") THEN "Powerpoint"
ELSE "Other"
END
Here’s what it should look like once you’ve added the statement.
We can then create a table with the newly created Downloaded File Type as our dimension and Total Events as our metric.
Depending on how many files you have downloaded, it should look something like this.
To get a breakdown of exactly which file was downloaded we created another table, but this time we choose Downloaded File Type and Event Label as our dimensions and Total Events is still our metric.
We then have a complete breakdown of which files were downloaded. You can choose to ‘apply filter’ to the first table, so we can filter the table below by file type.
Finally, in order to only show file downloads in these tables (and not other events) we create a filter for the tables that only includes the Downloads Event Category.
Hope you found this article about how to measure file downloads in Google Data Studio useful.
If you liked this article you might like my other blog posts.
Or you can follow me on Twitter!
Download Google Data Studio Templates
If you’d like to download one of my Google Data Studio reports as a template to use for your own data, you can visit Data Studio Templates and purchase one.
Sorry, but I find the post title is a bit misleading. Data Studio is not a Tracking tool, it can’t track File Downloads. You need Google Analytics for this, which then is used as a data source in Data Studio. The headline had me really confused. Just my 2Cents
Hi Julian, thanks for the feedback. Actually think you’re 100% correct about this so I’ve changed the post text from track to measure.
Hi, this was very helpful thank you! Am wondering if there is a way to show the PDF name only eg not the full URL?
Yes – if you use the variable ‘Click Text’ in GTM. So if you have a PDF called ‘apples_farmers_001.pdf” on your site, but the text on the link to download says “Apples Farmers Guide” then “Apple Farmers Guide” can appear in GA if you use Click Text as an Event action or label.
Hi Michael. Thanks your guides are really clear. Can you tell me why ‘Downloads’ doesn’t seem to be an option for me in Tag Manager? GA>Event>Category. When I click on the + it’s not there either. Thanks again.
Hi Aileen.
It’s possible GTM has been updated since this article was written. I’ll try take a look sometime.
Thanks very much