How to Track PDF Downloads in GA4: 3 Methods That Actually Work
Track PDF and file downloads in GA4 using enhanced measurement, GTM click triggers, or custom events. Step-by-step guide with code examples.
Tracking document downloads tells you which content assets drive engagement. GA4 has built-in file download tracking, but it does not always work correctly.
Method 1: Enhanced Measurement (Built-in)
GA4 automatically tracks file_download events for links pointing to common file extensions: .pdf, .xlsx, .docx, .csv, .txt, .rtf, .pptx, .zip, .exe, and more.
How to verify it is working:
1. Admin > Data Streams > Enhanced measurement > toggle "File downloads" ON
2. Click a PDF link on your site
3. Check GA4 DebugView or Realtime for the `file_download` event
Parameters automatically captured:
- `file_extension`: pdf, xlsx, etc.
- `file_name`: the filename
- `link_url`: the full download URL
Limitations:
- Only tracks `<a href="file.pdf">` links. Does not track JavaScript-triggered downloads, downloads behind form gates, or dynamically generated files.
- Does not capture which page the download happened on (you can see this in Explorations by adding `page_path` as a dimension).
Method 2: GTM Click Trigger (More Control)
For more control over which downloads are tracked and what metadata is captured:
Create the Trigger 1. Triggers > New > Click - Just Links 2. Fire on: Some Link Clicks 3. Condition: Click URL > ends with > `.pdf`
Create the Tag 1. Tags > New > GA4 Event 2. Event name: `file_download` 3. Parameters: - `file_name`: `{{Click URL}}` (or parse just the filename) - `file_type`: `pdf` - `page_path`: `{{Page Path}}` - `link_text`: `{{Click Text}}` 4. Trigger: your PDF click trigger
Tracking Multiple File Types Expand the trigger condition: - Click URL > matches RegEx > `\.(pdf|xlsx|docx|zip|csv)$`
Method 3: Custom Event for Gated Downloads
If your PDFs are behind a form (e.g., "Enter email to download the whitepaper"), enhanced measurement will not track it because there is no direct file link until after form submission.
In your form success handler:
`javascript
// After form submission and before triggering the download
dataLayer.push({
event: 'file_download',
file_name: 'ga4-audit-checklist.pdf',
file_type: 'pdf',
download_method: 'gated',
lead_email: formData.email // if you want to associate the download with the lead
});
// Then trigger the actual download
window.location.href = '/downloads/ga4-audit-checklist.pdf';
`
Making Downloads a Key Event
If downloads are a meaningful conversion (e.g., downloading a product spec sheet or pricing guide):
- Admin > Key events > New key event
- Event name: `file_download`
- Counting: Once per session
Or create a filtered version if only certain downloads matter:
1. Admin > Events > Create event
2. Name: whitepaper_download
3. Condition: event_name = file_download AND file_name contains whitepaper
Reporting on Downloads
To see download data:
1. Reports > Engagement > Events > file_download
2. Or create an Exploration with dimensions: file_name, page_path and metrics: event_count, total_users
This tells you which files are downloaded most and from which pages.
Not sure if your download tracking is working? Audit your GA4 setup →
Check your GA4 implementation
Run a free AI-powered audit to see how your tracking stacks up.
Start Free Audit