How to track file_download Events in GA4

Google Analytics BCS 5 years ago (2019-11-29) 1549 Views 0 Comments

Update time: January 14, 2025

This article introduces how to track file_download in GA4.

Suppose I want to track the file download tracking at this location, such as:

Enhanced Measurement Events

GA4’s enhanced measurement events have built-in file download tracking, called the file_download event.

Measurement option Events Triggered… Parameters
File downloads file_download Triggered when the user downloads the following file:

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

 

file_extension 
file_name 
link_classes 
link_domain 
link_id 
link_text 
link_url 

Enhanced measurement settings in Web stream details:

 

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

Just check 「File downloads」 and save, and you’re all set.

Read More : GA4 Event Tracking Series ② —— Enhanced Measurement Events

Custom Event

Track click file downloads as custom events.

Step 1 : Enable Built-In Variables

First enable some Built-In Variables, which will automatically get attributes to variables in GTM.

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

The main thing is to enable Click URL and Click Text.

 

Step 2 : Set Up the Trigger

View the source code of the tracked location:

We can know that the Click URL is https://www.bbccss.com/wp-content/uploads/2019/11/2025011405111591.zip, and the Click Text is “Download File Demo”, we can use these two attributes for trigger positioning.

 

In GTM , click「Triggers」——「New」——「Choose a trigger type to begin setup…」——「Click – All Elements」,Name it “Click-File Download “, and make the following settings:

 

 

Step 3 : Set Up the Tags

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:

 

Event parameters Use the default event parameters downloaded by Enhanced Measurement Events so that you can use these parameters directly in GA4 reports and share custom dimensions.

 

Step 4 : Preview and Publish

Next is the Preview test:

Tags is triggered,click it to check if the event parameter value is correct:

The event parameters are accurate and can be published.

Read More:

Step 5 : Verify Data in Reports

Generally, after 24 hours, we can see the data in GA4, such as:


If you don't understand, You can leave a comment below.
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