How do I track downloads (like PDFs or ZIP files) in GA4?
Applies to: Google Analytics 4 (GA4)
Last updated: May 2025
Problem
You want to know when users download files (such as PDFs, ZIPs, DOCXs) from your website. GA4 does not automatically track all file downloads unless Enhanced Measurement is properly configured or custom tagging is used.
Solution
GA4’s Enhanced Measurement feature tracks file downloads automatically for common file types. For more control or unsupported file types, use Google Tag Manager (GTM) to track them as custom events.
Option 1: Use Enhanced Measurement (Automatic)
GA4 automatically tracks downloads when:
- The file link is a direct anchor tag (
<a href="file.pdf">) - The file has a recognized extension (e.g.,
.pdf,.docx,.xls,.zip, etc.)
Steps:
- Go to https://analytics.google.com
- Admin > Data Streams > Select your Web Stream
- Under Enhanced Measurement, click the gear icon
- Ensure File Downloads is toggled on
This creates file_download events automatically with parameters like:
file_namefile_extensionlink_url
Option 2: Track Downloads with GTM (Custom Setup)
Use this method for greater accuracy, filtering, or for links that trigger downloads via JavaScript.
Step 1: Enable Click Variables
- In GTM, go to Variables > Configure
- Enable:
Click URLClick TextClick Classes
Step 2: Create a Link Click Trigger
- Go to Triggers > New
- Choose Trigger Type: Just Links
- Configure conditions, such as:
Click URLmatches regex:\.(pdf|zip|docx|xlsx)$
- Set trigger to fire on Some Link Clicks
- Name and save it (e.g., “Download Trigger”)
Step 3: Create a GA4 Event Tag
- Go to Tags > New
- Choose Tag Type: GA4 Event
- Set:
- Event Name:
file_download - Event Parameters:
file_name:{{Click URL}}link_text:{{Click Text}}
- Event Name:
- Attach the download trigger you created
- Save and publish
Step 4: Test in Preview Mode
- Use GTM’s Preview to click a download link
- Confirm the event fires
- Check GA4 DebugView for
file_downloadevents
Step 5: Register Custom Parameters (Optional)
To make file_name or link_text available in GA4 reports:
- Go to Admin > Custom Definitions
- Create a Custom Dimension
- Scope: Event
- Parameter:
file_nameorlink_text
- Save
Viewing Downloads in GA4
- Go to Reports > Engagement > Events
- Click on
file_download - Use dimensions like
link_url,file_name, or custom values in Explorations
Notes
- GA4’s Enhanced Measurement covers many file types but may miss JavaScript-based or dynamic downloads
- Use GTM for more flexibility, such as filtering by download type or creating download-specific conversions
- You can mark
file_downloadas a conversion in GA4 if it’s a key action





