How to Track file_download Events in GA4

Google Analytics BCS 7 years ago (2019-11-29) 3553 Views 0 Comments

Update time: March 16, 2026

GA4 can automatically track file downloads without requiring any custom code. By enabling Enhanced Measurement, GA4 sends a built-in file_download event whenever a user clicks a supported download link.

However, there are situations where the default tracking isn’t enough. For example, you may want to:

  • Track only specific file downloads.
  • Use a custom event name.
  • Send additional event parameters.
  • Track download buttons that don’t point directly to a file.

In this guide, you’ll learn two ways to track file downloads in GA4:

  • Method 1: Enhanced Measurement (recommended for most websites)
  • Method 2: Custom event tracking with Google Tag Manager (GTM)

 

Method 1: Track File Downloads with Enhanced Measurement

For most websites, Enhanced Measurement is the easiest way to enable file download tracking.

Once enabled, GA4 automatically sends the file_download event whenever a visitor clicks a supported file link.

Supported File Types

By default, GA4 tracks downloads for file extensions such as: pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma and many other common document, archive, audio, and video formats.

 

Event Parameters

The automatically collected file_download event includes several useful parameters.

Parameter Description
file_name Downloaded file name
file_extension File extension
link_url Download URL
link_text Anchor text
link_domain Link domain
link_id HTML ID attribute
link_classes CSS classes

 

Enable Enhanced Measurement

Enhanced measurement settings in Web stream details:

How to Track file_download Events in GA4

Click the gear icon to see the enhanced measurement settings interface:

How to Track file_download Events in GA4

Then simply enable File downloads and save the settings.

Once enabled, GA4 will automatically track file downloads without any additional configuration.

 

Method 2: Track File Downloads with Google Tag Manager

Although Enhanced Measurement is sufficient for most websites, GTM provides greater flexibility.

This method provides more flexibility and control over event naming and parameters.

Step 1 : Enable Built-In Variables

First, enable the relevant Built-In Variables in GTM.

These variables automatically capture click-related attributes.

In GTM , click「Variables」——「Configure」,Check these Built-In Variables of click:

How to Track file_download Events in GA4

These variables help identify which download link was clicked.

 

Step 2 : Create the Trigger

For example, suppose you want to track file downloads from a link like the one below:
How to Track file_download Events in GA4

Inspect the HTML source code of the download link:

How to Track file_download Events in GA4

These attributes can be used to define the trigger conditions.

 

In GTM , click「Triggers」——「New」——「Choose a trigger type to begin setup…」——「Click – All Elements」,Name it “Click-File Download “, and configure the trigger conditions using Click URL or Click Text

How to Track file_download Events in GA4

 

 

Step 3 : Create the GA4 Event Tag

Now create the GA4 event tag.

In GTM , click「Tags」——「New」——「Choose a tags type to begin setup…」——「Google Analytics: GA4 Event」,Name it “GA4-Event-File Download”, and make the following settings:

How to Track file_download Events in GA4

To maintain consistency with GA4’s built-in download tracking, consider sending the same parameters

This allows your custom implementation to align with GA4’s standard reporting structure.

 

Step 4 : Preview and Publish

Before publishing your container, verify that everything works correctly.

Open Preview mode in GTM to launch Tag Assistant.

After clicking the download link, check whether the GA4 event tag fires correctly.

How to Track file_download Events in GA4

Click the triggered tag to verify that the event parameter values are correct:

How to Track file_download Events in GA4

Click the triggered tag to verify that the event parameter values are correct.

If everything looks correct, you can publish the container.

 

Step 5: Verify the Event in GA4

After publishing, the event data will start appearing in GA4.

In most cases, it may take up to 24 hours for the data to appear in standard reports:

How to Track file_download Events in GA4

 

Which Method Should You Use?

Scenario Recommended Method
Track standard file downloads ✅ Enhanced Measurement
Track only specific files ✅ GTM
Send additional parameters ✅ GTM
Use a custom event name ✅ GTM
No coding required ✅ Enhanced Measurement

For most websites, Enhanced Measurement is the simplest and recommended solution. If your tracking requirements are more advanced, Google Tag Manager gives you complete control over triggers, event names, and parameters.

 

Like (1)
Post my comment
Cancel comment
Expression Bold Strikethrough Center Italic

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • Website