If you are displaying links to download any kind of files from your website you might want to monitor their performance and maybe stop maintaining some of those PDFs that are rarely or never downloaded.
Luckily GA4 is able to track such events automatically and you can access the file download report right there in Google Analytics 4 interface.
How file downloads are tracked in GA4?
When a visitor clicks on a link that opens or downloads a file then the “file_download” event is sent to GA4. The event will be triggered only if you have File downloads enabled from Enhanced measurements and the file extension in the link URL matches one of the common file extensions (e.g. pdf, xlsx, docx, etc.).
If you have worked with Regular expressions before, then GA4 will use the following pattern to decide if the “file_download” event should be fired:
If your files can have extensions that are not listed above, then unfortunately they won’t be tracked automatically by GA4 and you will have to add a custom tag to cover those cases.
Check if file download tracking is enabled
As File download tracking is part of Enhanced measurement events it needs to be enabled in order to trigger such events. Usually, it’s enabled by default when the GA4 property is created but you can double-check by opening an Admin section.
- Under Google Analytics 4 property select “Data Streams” and click on your web data stream to show settings.
- Under “Enhanced measurement” click on the settings icon to show enabled event list.
- “File downloads” should be enabled. If it’s not – enable it and save settings.
You will have to wait until the next day to see the first file download events if you have just enabled this setting.
File downloads in default GA4 reports
Event name “file_download” will be listed under Reports > Engagement > Events section same as any other collected events.
Unfortunately, default reports could show you only the total file download count, you can’t see which files and where they were downloaded from.
Custom exploration report with file download
To create a more practical file download report we will use Google Analytics Explorations (custom reports).
- Create a new empty Exploration from the “Explore” section in GA.
- Import 3 dimensions – Event name, File name, “Page path and screen class”
- From metrics import – Total users and Event count
- Add “File name” and “Page path and screen” to Tab settings as Rows
- Add Event and user count in the Values section
- Some data will already appear in the table on the right side of the screen, but we still need to add a “file_download” filter to see only download-related events.
- Scroll down to the “Filters” section in Tab settings and select “Event name” as a dimension.
- Filter it to exactly match – “file_download” and click Apply.
Now you should see a summary of all file downloads split by file name and page where the file was downloaded.
And that’s basically it. Additionally, you can output the Link text dimension if the same file can be downloaded on some pages multiple times and adjust the report to include segments or other dimensions (e.g. device category) that might be relevant to your website.