Skip to content
FunnelGuard

Fix guide by FunnelsGuard

file_download not tracked for lead magnet: how to fix it

TRK-064Low impactDetectedBy FunnelGuardPublished Updated
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.

Where the download gets lost
  1. Landing pageVisitor arrives from an ad or search
  2. Form submittedLead is captured
  3. Download linkRedirect or no file extension
  4. file_download eventNever sent to GA4
  5. Reports and audiencesNo data on downloaders

The visitor still gets the file, but GA4 never sees the download.

A download with no event

The click happens, but no tag sends file_download.

How to check if your site has it

Test the download yourself
  1. 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.

  2. Complete the lead magnet journey

    Fill in the form and click the download button or link, as a visitor would.

  3. Look for file_download

    Watch the event stream. You should see file_download with parameters such as file_name, file_extension and link_url.

  4. Check Enhanced measurement

    Go to Admin > Data streams > your web stream > Enhanced measurement > gear icon, and confirm File downloads is switched on.

  5. 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.

Common delivery methods and whether GA4 tracks them automatically
How the file is deliveredTracked automatically?
Direct link to /guide.pdfYes, if Enhanced measurement is on
Link to /download?id=123 that redirectsNo
Signed or temporary URL with no extensionNo
File emailed after form submitNo, and not a site click
Button that runs JavaScript to build the fileNo
Link opened inside a cross-origin iframeNo

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.

Send file_download by platform
  1. 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.

  2. 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.

  3. 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.

  4. 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.

Send file_download from your own link (gtag)javascript
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
  });
});
Example link the snippet above will trackhtml
<a href="/download?id=123" data-lead-magnet="seo-checklist">Download the checklist</a>

How to confirm it's fixed

Confirmation checklist
  • 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 and after

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

Habits that keep it working
  • 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.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.