How to Track File Downloads in Google Analytics 4 (GA4)

I was happy to find out that Google Analytics 4 can track file downloads. However, I didn’t find any native report in the interface to display the downloaded file names, other than for the last thirty minutes. It actually requires jumping through a lot of hoops to set up a report to do this. After searching online, I found a great video from Growth Learner which explains this and many other things.

Google Analytics 4 report showing downloaded files
Google Analytics 4 report showing downloaded files

In this post, I’ll try to summarize the steps to generate a report in Google Analytics 4 showing the filenames of the files that have been downloaded on your site. No Google Tag Manager required.

1. Make Sure Tracking of File Downloads is Enabled

The first thing you should do is verify that Enhanced Measurement is enabled for File Downloads. This is enabled by default, so you’re probably fine, but if you want to verify, log into your GA4 account, here’s how:

Click Admin (gear icon in lower left corner) -> Setup Assistant -> Data Streams -> Click your site name

Once there, click “+ 3 more” in the Enhanced Measurement section to show all of the items you’re measuring. Make sure “File downloads” is one of them.

Google Analytics 4 Enhanced Measurement showing File downloads
Google Analytics 4 Enhanced Measurement showing File downloads

If not, add it by clicking the gear icon.

2. Create an Exploration

The next thing you want to do is create an “Exploration”, which is just kind of a fancy name for a custom chart.

In the left sidebar menu of Google Analytics 4, click on Explore, then click the plus sign to create a blank Exploration.

Google Analytics 4 Explorations
Google Analytics 4 Explorations

In the top left, change the Exploration Name to something that makes sense, such as “Downloads”.

3. Add Variables to the Exploration

In the left Variables column, there are areas for Dimensions and Metrics. You’ll want File name as one of your dimensions and Event count as one of your metrics. Click the plus sign to add these.

Google Analytics 4 variables
Google Analytics 4 Exploration variables to add

4. Drag to Tab Settings

Once you’ve added the proper variables in the Variables column, they become available to drag to the Tab Settings column.

Click the bar graph icon near the top, then drag “File name” to BREAKDOWNS and “Event count” to VALUES as shown:

Google Analytics 4 Exploration Tab Settings
Google Analytics 4 Exploration Tab Settings

Even though you will see data, you’re not done yet…

5. Set Filters

You need to filter the result so that only file downloads show up in the graph. Go to the FILTERS section. Drag or select Event name, then set it to “exactly matches” “file_download” as shown:

Google Analytics 4 Exploration filter
Google Analytics 4 Exploration filter

Once you’ve done that, you should see a nice graph to the right with downloaded filenames as the y-axis and the number of downloads as the x-axis!

If you have long filenames, it might be kind of hard to read, but you can export the results to a spreadsheet.

6. Set Date Range

Near the top of the left Variables column, you can set the date range for the graph.

7. Set Data Retention Time

The time frame for the graph is set in the pulldown in the Variables column. Reader Tony noticed that in his account, he could only select the last 60 days of data though. I had the same problem with my account too!

The solution, he found, is to set your “data retention” to 14 months (the max) instead of 2 months (the default). To do this, go to your GA4 account -> Admin (gear icon in the lower-left corner) -> Data Settings -> Data Retention, and set that to 14 months as shown:

Limitations

The 14-month data storage limitation is ludicrous in my opinion. Hopefully, Google will extend that in the future.

Another limit that reader David discovered is a 100-character limit on the path plus filename. Even if you export the data, the path/filenames will be cropped at 100 characters. I don’t know of a way around this either, as the limit seems to be baked into Google’s database.

You can see more of the filenames by hovering over them with the mouse, but they’re still limited to 100 characters.

Hope this helps! Did it work for you? Please leave a comment below. – Brian

Shares

Please Leave a Question or Comment

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

28 Comments
Inline Feedbacks
View all comments
mel
mel
3 months ago

Hi Brian, love the article! Do I need to set up GTM tags for this to work?

I currently have GTM set on a few pdfs, and have noticed that my report bundles everything together or shows data for pdfs that have no GTM set on them. I was hoping to not use GTM and that GA4 would automatically track all pdf downloads?

Connie
Connie
6 months ago

Thank you! So helpful!

Ethan
Ethan
1 year ago

Thanks Brian!
What if my Filters section isn’t showing me the option ‘Event Name’?

Ethan
Ethan
1 year ago
Reply to  Ethan

Never mind – I figured it out. Thanks

David Lewis
David Lewis
1 year ago

Super helpful. Thank you.

Are you aware of any way to get the full filename of downloads. We have some longer paths and it clips them, and that makes it a bit of a challenging to identify the download. I’ve tried saving in other formats, but it clips all the same.

David Lewis
David Lewis
1 year ago
Reply to  Brian Shim

Hi Brian,

Thanks. Yes, I have been doing the exports (tried all flavours – Google sheets, csv) but still clips the full path.

Here’s a few examples. First two are clipped. The last is fine.

/DAM/DAM-ISC-SAC/DAM-HLTH/STAGING/texte-text/diseases_coronavirus-hlt_safety_resrs_parent-resrs-colo

/DAM/DAM-ISC-SAC/DAM-HLTH/STAGING/texte-text/diseases_coronavirus-hlt_safety_resrs_6_mnths_5yrs_bstr

/wp-content/uploads/2020/04/CoronaVirus_Factsheet__RED_ENG.pdf

Even the mouse over of the item shows a clipped file path.

Even if I could only show just this bit “filename.xxx” without the path before it would likely help. Could also be that our paths are just too long.

Cheers,

David

David Lewis
David Lewis
1 year ago
Reply to  Brian Shim

Hi Brian,

Thanks for confirming my thoughts – character limits.

That’s too bad. Curse you google. ;)

Thanks for your time.

Maya
1 year ago

Great info, thank you!
We have some file downloads that are not automatically tracked through Enhanced measurements, for example .dmg downloads for macOS. Is there an easy way to track those too?

Andrew Enoch
1 year ago

Just what I was looking for..unbelievable how difficult this information is to find! Thankyou Brian!

Leslie Church
Leslie Church
1 year ago

Great information. Thanks! Is there any way to export from one account into another account?

Tony Ballinger
Tony Ballinger
1 year ago

Very helpful article! When I look at my file downloads report, it won’t let me select a start date older than 60 days. Is there some way to see more than the past 60 days, or can the file report only show 60 days of activity? Thanks for any guidance you can provide on this.

Tony Ballinger
Tony Ballinger
1 year ago
Reply to  Brian Shim

Brian,
I just discovered that the default data storage for a GA4 account is set to 60 days. It appears to have 2 options: 2 months and 14 months. We’ve now set ours to 14 months. Hope this helps someone else!

Matin J. Osborne
1 year ago

Very helpful — thank you. Before finding your page I thought I was going to have to spend hours learning about Google Tag Manager!

Karsy
Karsy
1 year ago

That worked great! Can we save these reports and schedule emails to clients like we did in GA3?

Last edited 1 year ago by Karsy
Jake
2 years ago

Exactly what I was looking for. Thanks!