Troubleshooting

File Download Tracking Not Working

3 min read··By the TrackingCoder team
🔧

Common reasons file-download tracking doesn’t fire

  1. GTM container not published - You imported the container but didn’t click Submit → Publish.
  2. GTM snippet not installed on your site - The GTM code needs to be in your site’s <head> and <body>.
  3. Extension regex doesn’t match the URL - Trackers usually look for .pdf, .zip, .docx at the end of the URL. URLs with query strings (file.pdf?v=2) or fragments (file.pdf#page=3) trip strict $-anchored regexes. The TrackingCoder snippet handles both, but custom GTM triggers often don’t.
  4. Link has target="_blank" - Opening in a new tab is fine and even helps deliverability. Opening in the SAME tab is the dangerous case: the page unloads before the GTM tag finishes firing, and you lose the event. Either add target="_blank" or enable “Wait for Tags” on the trigger (max ~2000ms).
  5. Cloud storage links don’t have file extensions - Dropbox (?dl=0), Google Drive (/file/d/abc123/view), and Box (/s/abc123) shareable URLs don’t include the file extension in the URL. A regex-only trigger won’t match them. You either need a domain-based trigger (Click URL contains drive.google.com) or to mark these links with a data-tc-download attribute and target that.
  6. JavaScript-driven downloads - Some sites build the file at click time (creating a Blob, calling URL.createObjectURL()) instead of using a normal <a href>. The href is empty or javascript:void(0) when GTM evaluates it. You need a click trigger filtered by element class or text instead.
  7. Inline PDF preview, not a download - On many browsers PDFs open in-tab via PDF.js. The user perceives that as “opening” the file, not downloading it - but no download event fires. Decide whether to count previews as downloads in your analytics, then trigger accordingly.

Step-by-step debugging checklist

  1. Verify GTM is installed - Visit your site, right-click → View Page Source, search for “GTM-”. If you don’t see it, GTM isn’t installed.
  2. Check GTM Preview mode - In GTM, click Preview. Navigate your site and trigger the event. Look for your tag in the Tags Fired section.
  3. Check the trigger - If the tag shows as “Not Fired”, click on it to see which trigger conditions aren’t met.
  4. Inspect the link element - Right-click → Inspect. Confirm it’s <a href="...somefile.pdf">. Note any target, download, or onclick attributes.
  5. In GTM Preview, click the link - A Click event should fire and the Click URL variable should contain the file URL. If Click URL is empty or doesn’t contain the file, the link is JS-driven and a regex trigger won’t work.
  6. If links are same-tab: enable Wait for Tags - On your Click trigger, set Wait for Tags = 2000ms and Check Validation. This delays the navigation just long enough for the GA4 tag to send.

How to verify it’s working

  1. Open GTM Preview/Debug mode
  2. Navigate to your site
  3. Trigger the event (click a download link)
  4. Check the GTM debug panel - your tag should appear under “Tags Fired”
  5. Check GA4 DebugView (GA4 → Admin → DebugView) to confirm the event arrived

Still didn’t work?

Our team can help. Describe what’s happening and we’ll get back to you within 24 hours.

Still didn't work? Report this issue

Fill in the details below and our team will review it within 3-5 business days. We aren't obliged to refund - but if we genuinely can't make it work, we may credit you back. Either way, your credits remain usable on a different event or site.

No need to type https:// - we'll add it for you.

Min 20 characters (0/20).

Context automatically included: file download tracking

Skip the manual setup

TrackingCoder detects your CMS and plugins automatically, then generates ready-to-use tracking code. No more adapting generic tutorials - get code tailored to your exact setup in under 2 minutes.

Try TrackingCoder Free →

2 free credits on signup. No card required.