On this page
What this issue is
A lead magnet is a free file you give away in exchange for contact details, such as a PDF guide, checklist, template or spreadsheet. GA4 has a built-in event called file_download. It is meant to fire when a visitor clicks a link to a file.
The issue is that the download happens but GA4 records nothing. The visitor gets the file, but your reports show no file_download event, so you cannot tell how many people downloaded it or where they came from.
Automatic tracking is limited. Enhanced measurement only catches clicks on links whose address ends in a file extension it knows (for example pdf, doc, docx, xls, xlsx, csv, zip, txt, ppt, pptx, mp3, mp4). It does not catch downloads that start from a form success message, a redirect, a signed URL without an extension, or a JavaScript-generated file.
Why it costs you leads or sales
The impact is usually low but real. A missing download event does not stop anyone getting the file. It hides what happens after the form: you cannot tell whether people actually open the lead magnet, which traffic source brings the downloaders, or which version of the offer works best.
That affects decisions. You may pause a campaign that is working, or you may not be able to build an audience of people who downloaded the file for retargeting or for a Google Ads conversion.
- Landing pageVisitor arrives from an ad or search
- Form submittedLead is captured
- Download linkRedirect or no file extension
- file_download eventNever sent to GA4
- Reports and audiencesNo data on downloaders
The visitor still gets the file, but GA4 never sees the download.
The click happens, but no tag sends file_download.
How to check if your site has it
Turn on DebugView
In GA4 go to Admin > DebugView. Open your site with the Google Tag Assistant debugger, or use GTM Preview mode, so your visits show up in DebugView.
Complete the lead magnet journey
Fill in the form and click the download button or link, as a visitor would.
Look for file_download
Watch the event stream. You should see
file_downloadwith parameters such asfile_name,file_extensionandlink_url.Check Enhanced measurement
Go to Admin > Data streams > your web stream > Enhanced measurement > gear icon, and confirm File downloads is switched on.
Inspect the link
Right-click the download button and copy the link address. If it does not end in a file extension, or goes through a redirect, Enhanced measurement will not catch it.
| How the file is delivered | Tracked automatically? |
|---|---|
| Direct link to /guide.pdf | Yes, if Enhanced measurement is on |
| Link to /download?id=123 that redirects | No |
| Signed or temporary URL with no extension | No |
| File emailed after form submit | No, and not a site click |
| Button that runs JavaScript to build the file | No |
| Link opened inside a cross-origin iframe | No |
How to fix it
First make sure the basics are on. If the link is a plain file link and the event is still missing, Enhanced measurement is probably off, or another tag is blocking it. If the delivery is a redirect or script, send the event yourself.
Create a trigger
Triggers > New > Click - Just Links. Choose Some Link Clicks and set Click URL contains your file path (for example /download/guide) or Click Classes contains your button class.
Create a GA4 Event tag
Tags > New > Google Analytics: GA4 Event. Pick your Google tag or measurement ID and set Event Name to file_download.
Add parameters
Add file_name (for example the lead magnet title), file_extension and link_url using the Click URL variable. Enable it in Variables > Configure if missing.
Avoid double counting
If Enhanced measurement already catches some downloads, only target links it misses, or switch off File downloads in Enhanced measurement and use your tag alone.
Check how the file is linked
In the Media Library copy the file URL and link to it directly rather than through a download-manager redirect where possible.
Use GTM or your analytics plugin
If a download plugin or form plugin serves the file through a script, add the GTM trigger and tag from the Google Tag Manager tab, or fire the event from the plugin's success redirect.
Test with a cache cleared
Clear any page cache so the updated tag or link is served, then retest in DebugView.
Link to the file in Files
Upload the file at Content > Files and use its cdn.shopify.com link. It ends in the file extension, so Enhanced measurement can catch it.
For digital download apps
If an app delivers the file from its own page, add a GTM click trigger or a custom pixel event on that page.
Link to the uploaded asset
Link the button to the asset in the Assets panel so the URL ends in .pdf or similar.
Or add a custom event
If the file is revealed after a form, add the custom code below in Project settings > Custom code > Footer code, or use GTM.
Use a direct file link
On the thank-you page, link the button to the hosted file URL rather than a workflow-sent email link.
Add tracking code
Add the snippet below under the funnel step's Tracking Code > Footer, or fire it from GTM if your funnel uses it.
Use a document link
Link the button to a Document so it points at the file directly.
Add a custom event
Use Marketing & SEO > Marketing integrations > Google Tag Manager, or Custom Code in Settings, to fire the event on click.
Link to the uploaded file
In the button settings choose File and upload the document, so the link ends in the file name.
Add code if needed
If delivery is through a form redirect, add the snippet below in Settings > Advanced > Code Injection > Footer.
Push the event on click
Use the gtag snippet below on the download link, adjusting the selector, file name and extension.
Or push to the data layer
If you use GTM, push a dataLayer event and trigger your GA4 tag from it.
document.addEventListener('click', function (e) {
var link = e.target.closest('a[data-lead-magnet]');
if (!link) return;
gtag('event', 'file_download', {
file_name: link.getAttribute('data-lead-magnet'),
file_extension: 'pdf',
link_url: link.href
});
});<a href="/download?id=123" data-lead-magnet="seo-checklist">Download the checklist</a>How to confirm it's fixed
- DebugView shows exactly one file_download event per click
- file_name, file_extension and link_url have real values, not undefined or (not set)
- The event still fires when you reach the file from the form success step, not only from a direct link
- Reports > Engagement > Events lists file_download after 24 to 48 hours
- If you use it as a key event or audience, it appears in that setup
Before
- Download link goes through a redirect
- No file_download in DebugView
- Cannot tell which campaigns bring downloaders
After
- Tag or code sends file_download on click
- One event per download with file_name
- Downloads can be reported by source and used for audiences
How to prevent it happening again
- Retest the lead magnet journey after changing the form, theme, download plugin or hosting
- Keep download links as direct file links where you can
- Name the file in the file_name parameter so reports are readable
- Document which tag sends the event so nobody adds a duplicate
- Review GTM changes in Preview mode before publishing
- Check DebugView whenever you replace the lead magnet file or URL
How FunnelGuard handles this
FunnelGuard detects this issue today. A robot visitor runs your lead magnet journey on a schedule, from the EU or the US, and checks the tracking hits sent to GA4 at each step. If the file_download hit does not arrive after the download step, the check fails.
A failure is re-checked from a second region before one alert goes out, by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) so you can filter it from reports. The Free plan covers 1 site and 2 journeys with daily checks and no card, and a free read-only website audit is available too.
Questions people ask
Why is my file_download event not showing in GA4?
Usually Enhanced measurement is off, or the link does not end in a file extension GA4 recognises. Downloads started by redirects, scripts or signed URLs are not caught automatically. Check DebugView, then send the event yourself with Google Tag Manager or gtag.
Does GA4 track PDF downloads automatically?
Yes, if Enhanced measurement has File downloads switched on and the link points straight to a file such as a .pdf. It records a file_download event with file_name, file_extension and link_url. Links that redirect or lack an extension are not tracked.
How do I track a lead magnet download in Google Tag Manager?
Create a Click - Just Links trigger that matches your download link, then a GA4 Event tag named file_download. Add file_name, file_extension and link_url parameters. Test it in Preview mode and DebugView before publishing.
Why does file_download fire twice in GA4?
Enhanced measurement and a custom tag are probably both tracking the same click. Switch off File downloads in Enhanced measurement, or restrict your tag to links it does not cover. Confirm in DebugView that one click gives one event.
Can I track a download that happens after a form is submitted?
Yes. Fire the event when the download link is clicked on the thank-you step, or when the file starts loading, using a click trigger or a dataLayer push. A form submit alone is not a download, so keep generate_lead and file_download as separate events.
How long does it take for file_download to appear in GA4 reports?
DebugView shows it within seconds. Standard reports can take 24 to 48 hours to include new events. If it is missing from DebugView, the problem is in your setup, not the reporting delay.
How can I be alerted if download tracking breaks?
Use a synthetic monitor that runs the lead magnet journey and checks the GA4 hit. FunnelGuard does this on a schedule and sends one alert with a screenshot and likely cause when the file_download hit is missing.
Related issues
- TRK-043generate_lead not sent on form submitFix guide
- TRK-049Required event parameter missing (form_id, method)Fix guide
- TRK-050Parameter value is undefined, null or '(not set)'Fix guide
- TRK-062Click events for WhatsApp / call not trackedFix guide
- TRK-063Click event named differently than expected (whatsapp_click vs click_whatsapp)Fix guide
- TRK-065Booking confirmation event missing after Calendly/Cal.com bookingFix guide