Sub topic 8
File Downloads and Recognized File Extensions
This chapter assumes you have a GA4 property with a web data stream, the Google tag installed, and basic knowledge of events and parameters. You should also be familiar with the GA4 Admin interface.
What the `file_download` event records
Enhanced measurement can automatically record a file_download event when a visitor clicks a link to a downloadable file. GA4 detects the file type from the link URL, usually by examining the extension after the final period.
For example, a link such as https://example.com/guides/setup.pdf can produce a file_download event. A link to https://example.com/pricing usually will not, because it has no recognized file extension.
The event commonly includes these parameters:
| Parameter | Meaning | Example |
|---|---|---|
| `file_name` | Name of the downloaded file | `setup.pdf` |
| `file_extension` | Extension detected by GA4 | `pdf` |
| `link_text` | Visible text of the clicked link | `Download setup guide` |
| `link_url` | URL of the clicked file link | `https://example.com/guides/setup.pdf` |
Other link-related parameters can also appear, depending on the implementation and tag configuration. The event means that the link was clicked. It does not prove that the browser finished downloading the file or that the visitor opened it.
Recognized file extensions
GA4 recognizes common document, spreadsheet, presentation, compressed archive, executable, audio, and video extensions. Examples include:
- Documents:
.pdf,.doc,.docx,.txt,.rtf - Spreadsheets:
.csv,.xls,.xlsx - Presentations:
.ppt,.pptx - Archives:
.zip,.rar,.7z,.tar,.gz - Audio:
.mp3,.wav,.m4a,.ogg - Video:
.mp4,.mov,.avi,.mpeg - Applications:
.exe,.dmg,.apk
The extension must normally be visible in the URL. A download endpoint such as /download?id=123 may not be recognized, even if the server later returns a PDF. Query strings can also make diagnosis harder when the actual file type is hidden behind a redirect.
How the detection flow works
Enable and test file downloads
In GA4, open Admin, select the relevant Data stream, and open Enhanced measurement. Make sure enhanced measurement is enabled. Open its settings and confirm that File downloads is enabled.
Use a test link with a recognized extension:
<a href="/files/product-guide.pdf">Download the product guide</a>Open the page with Tag Assistant or another debug setup, click the link, and inspect the resulting event. In DebugView, look for file_download. Select the event and check whether file_name, file_extension, link_text, and link_url contain the expected values.
A normal browser download may navigate away from the page immediately. If the event does not appear, test the same link in a debug session and check whether another tag, consent setting, redirect, or content security policy prevents the Google tag from sending data.
Common coverage gaps
Enhanced measurement does not cover every download pattern:
- A JavaScript button may create a download without an ordinary anchor link.
- A link may use a URL without a recognizable extension.
- A redirect may hide the final file type.
- A file may be generated dynamically by an API.
- A single-page application may intercept the click before the normal link behavior occurs.
- A custom listener and enhanced measurement may both send events for the same click.
Avoid counting file_download as a completed download. If completion matters, track a server-side download, a confirmed response, or another business-specific signal.
Exercise
Exercise
A link points to /download?id=42, and the server returns a PDF. Why might GA4 fail to send file_download, and what is one solution?
Show answer
GA4 may not recognize the file type because the URL has no PDF extension. Use a URL such as /files/report.pdf, or send a custom event when the download action occurs.