Some of the automatic events GA4 logs for your website are hard to report on in GA4. The one we’re going to look at today is the file download event. We’ll look at what you can report on in GA4 and create an exploration to get more detail. Then we’re going to set up a custom metric to count file downloads and make a custom GA4 report for file downloads look great.
So let’s have a look.
Create a GA4 Report Showing File Downloads
Since we don’t have a standard report that shows file downloads, we’re going to create one and save it into the Reports menu. In doing so, you’ll see one of the limitations with reporting on file downloads and regular reports. Later, we’ll create a custom metric for reporting on file downloads, which will make this custom report in GA4 a little bit nicer to look at.
- Go to the Reports section in GA4, and click on the “Library” icon in the bottom left corner. To add a new report, click “Create new report”, then click “Create detail report”, and start with a blank report.
- On the right, click on Dimensions and add “File name” and “File extension” and then click Apply.
- Click Metrics. Unfortunately, there is not a built in metric related to file downloads, that’s what we’re going to be creating. For now, add “Event Count” and then click Apply.
- In the upper right, “Save” this report as “File Downloads”.
Now we have a taste of what this report is going to look like. It would be really nice if we could add a filter for event name–then we could filter for just file downloads. But we can’t.
That means we see one line in the report table with a whole bunch of events counted. Most events in the website are not file downloads and so don’t have file names associated with them. Once we create our custom metric, we will be able to get rid of that line.
Now let’s add the report into the Reports menu.
- Click back to return to the Library. Find the Life cycle collection box, and click on “Edit collection”.
- In the search box, find the report you just created and drag it down to the bottom of the Engagement menu.
- Save, select “Save changes to the current collection” and click the back button.
Now you’ll see the File downloads report under the Engagement section of your Reports menu.
This gives you the ability to show file downloads without doing any further customization. If you’d like to remove that extra line on the report that includes non-file_download events, skip down to the Custom Metric section of this blog.
Use Explorations to Do Report on File Downloads
Now let’s have a look at what we can do in Explorations where there is a little bit more control.
- Go to Explorations and click Blank.
- On the left-most column, under Dimensions, add File name, File extension, and Event name. Then drag File name and File extension into the middle column under Rows.
- Drag Event name to the middle column under Filter. Select “exactly matches”, and select file_download. Click Apply.
- On the left-most column, under Metrics, add Total users and Event count. Then drag them into the middle column under Values.
You’ll see a table listing each file name, its event count, and the total users. This data is filtered for just events that are file download events, so that’s an advantage over the custom report we created above.
Add a Custom Metric for File Download
Another way we can customize GA4 to get a better file download report is to create a custom metric that counts file downloads. We’re going to be modifying an existing event, GA4’s automatic file_download event, by adding a parameter to it which records a “1” every time a file download happens. And then we’ll add the metric to the file download report we made above.
One note, custom metrics start collecting data when you set them up, and don’t apply to historical data.
- Go to Admin and click on Events. Click “Modify event” and then “Create”.
- Click “Create”. Enter the values below and click “Add modification”.
- In Admin, go back to Custom definitions. Select Custom metrics, and click “New custom metric”.
- Set up the metric with these entries:
- Find the File download report you created earlier in Reports > Engagement. Click the pencil icon in the upper right.
- Click on Metrics and then “Add metric”. Select your custom metric “Downloads”.
- We can remove Event count, we don’t need that any more. Click the “x” to remove Event count.
Now your report only shows rows for file download events and counts the number of downloads.
We’ve got loads more GA4 and Looker Studio videos & tutorials, check them out on our GA4 tutorials page.