Last Modified on January 18, 2024
As a result of its Enhanced Measurement features, tracking file downloads has never been easier than it is now with GA4.
How to track PDF downloads in Google Analytics 4 is achieved by simply enabling the File downloads option in Enhanced measurement. This is the most efficient way to do it and it requires only a few clicks.
However, different situations may call for different methods. We’ll look at these alternatives, and other aspects related to file downloads in GA4, as well.
This is because tracking PDFs will bring up unresolved questions such as where to find your file download data and what to do with it.
Here’s what we’ll cover:
- Benefits of Tracking File Downloads
- Can Google Analytics Track PDF Downloads
- How Do I Track PDF Downloads in Google Analytics 4
- Tracking PDFs With Google Tag Manager
- How Do I View Downloads in GA4
- PDF Link Tracking
Ready to do this? Let’s go!
Benefits of Tracking File Downloads
If producing a lot of valuable resources is part of your digital marketing strategy, then tracking PDF downloads or any file downloads will save you time and money and will drive your conversions.
Knowing which resources are downloaded the most narrows your efforts and helps you focus on creating or improving content that your audience is ready to explore in depth. Thus, time will not be wasted on creating files that don’t add any value to your audience.
Unless you’re producing file downloads yourself, in many cases you’ll have to hire a professional with good graphic designing skills to create files that are visually attractive to keep your audience engaged.
There are platforms where you can design PDFs for free, but files that are state-of-the-art files due to great copywriting, imagery, and design, come with a cost that must be included in your content marketing ROI calculations.
Therefore, tracking them and analyzing them accurately is important.
Can Google Analytics Track PDF Downloads
GA4 can track PDF downloads but also most file downloads (this also includes audio and video files).
After a user clicks on the download link, GA4 records this activity as an event. More information is also available to you, due to Event parameters which are extra details added by default to your event.
These parameters allow you, for example, to know the name of the file, its URL, etc.
Here are the default settings:
- File extension (from file_extension)
- Filename (from file_name)
- Link classes (from link_classes)
- Link domain (from link_domain)
- Link ID (from link_id)
- Link text (from link_text)
- Link URL (from link_url)
You can deepen your analysis by exploring GA4 reports. We’ll cover exactly how to do that further in this post.
How Do I Track PDF Downloads in Google Analytics 4
There are several options to track PDF downloads in GA4 and we’ll cover them all. You are free to choose the option that suits you best.
It is often recommended to use GTM, but it can happen that, as a marketer, you inherit a role in which you have a limited field of action. Also, not all site owners have the same needs.
We are going to look at 3 ways to track PDF downloads in GA4. You can use:
- Enhanced Measurement
- Google Tag Manager
- Plugins
Which option should you choose?
- Use Enhanced Measurement for the fastest way to track PDF downloads. If you’re actively using Google Tag Manager, you can still use Enhanced Measurement. Just don’t use them both to track PDFs at the same time or you will risk collecting inflated data in GA4.
- Use Google Tag Manager if there are chances that you will customize your tracking setup (or just because you like having your tracking all in one place).
- Use plugins when you either don’t have another choice (no access to the company’s analytics account) or if you need a simple solution with reports that are straight to the point. Reports from plugins tend to be very direct and easy to understand. They answer simple questions such as which PDFs are the most downloaded.
For this tutorial, we’ll track the following PDFs:
Tracking PDFs With Enhanced Measurement
One of the easiest ways to track your PDF downloads in GA4 is to use its Enhanced Measurement tracking capability.
In less than 5 clicks, you can start tracking your downloads without a complex setup or a line of code.
On the other hand, you must first understand your present needs and have an idea of how they can be met in the future. Generally, PDFs do not require analytics customization, so you can use Enhanced Measurement to track them.
However, if you are thinking of customizing for any reason the parameters that accompany your events, then opt for GTM.
Let’s start. Go to Admin → Data Streams → Web (select your website). In the Web Stream Details page, click on the icon settings in the Enhanced Measurement section.
Make sure that the File downloads option is activated.
That’s it. It’s as simple as that.
Tracking PDFs With Google Tag Manager
First, you should disable the File downloads option in Enhanced measurement to avoid double tracking.
Go to your GTM workspace and create a trigger.
If you don’t know how tags and triggers are created in GTM, our Google Tag Manager tutorial for beginners will get you started.
Follow the configuration of our Trigger.
If the Click URL variable is not available, make sure to enable all the Built-In Variables for Clicks.
To do so, go back to your Workspace, go to Variables, and click Configure. Enable the Clicks variables you need.
Rename your Trigger and save it. The second step is to create your Tag.
You can simply follow our naming conventions here. However, note that the Event names and the Parameter Names (under Event Parameters) aren’t named at random.
When naming Events in GA4, it is always recommended to use GA4’s naming conventions.
💡 Top Tip: Always check if GA4 has a naming convention for the event you’re trying to track. If nothing is there, then feel free to use a custom name. It’s not mandatory, but it’s most recommended. Plus, it keeps all your setups more organized.
You can name your events after those found in these types of GA4 events:
- Automatically collected events
- Enhanced event measurement
- Recommended events
So how did we do it?
When we looked at the most practical way to track PDF downloads, we used Enhanced Measurement because this is where you’ll find the event related to file downloads.
The file_download event can be tracked by GA4 once enabled.
Therefore, GA4 already has naming conventions for this event and its parameters. These are the ones we used.
You can either go back to the previous images or read the official documentation.
These are the naming conventions for file download events (including PDFs) and their parameters:
Event name | Parameters |
file_download | file_extension file_name |
link_classes | |
link_domain | |
link_id | |
link_text | |
link_url |
How to Track PDFs With Plugins
Another quick and easy way to track PDF downloads in GA4 is to use a plugin.
Most marketers recommend using Google Tag Manager as the primary tag management solution for analytics setups on your website.
GTM is flexible and facilitates interaction tracking. Above all, it integrates with a large number of platforms, including the most important ones on the web.
However, while it is recommended (for those not using GTM) to migrate to GTM, several situations make this not practical or immediately feasible in the case of PDF tracking.
This is where plugins come into play.
First, as much as we love GA4 and its built-in tracking features, we cannot ignore the difficulty that many users have in finding PDF download data in the Events report.
The way downloads are reported (a mix of a graph, a scatterplot, and tabular data) or built (think of Explorations) isn’t intuitive to those who are not experienced with Google Analytics.
Depending on the depth of your analysis, a plugin can fulfill the need of getting a straightforward report telling you “these are your PDFs and these are the number of times they were clicked/downloaded.”
Plugins such as MonsterInsights will display your top downloads.
If further analysis is required such as knowing the locations (page, country, source/medium, etc.) responsible for your downloads, simply click on the View All Download Links Report button. This directs you to the right GA4 Events report related to your PDF downloads.
Also, if you’ve relied heavily on plugins since your site was created, you already have a data collection system in place that you’re used to and the information you need. Changing everything for a few tracking needs seems impractical.
On the other hand, if your digital marketing questions are evolving and require more technical setups, then you will probably need GTM down the line.
In other cases, you may not have access to analytics configuration or permission to change plugins, meaning that you can’t migrate to GTM and have to work with what’s available.
🚨Note: Even if plugins offer solutions that may be more practical than GA4, continue to use GTM if you are already using it. Otherwise, you risk duplicating your data in GA4, which will report inflated figures.
How Do I View Downloads in GA4
Seeing file downloads data in GA4 is not easy or obvious, especially if it is to analyze them.
You can view file downloads in three different ways:
- Explorations
- DebugView
- Realtime reports
- Engagement reports (in Events)
🚨 Note: if you’re only interested in analyzing PDF downloads then focus on Explorations. The others won’t help you much in finding answers such as which file was downloaded the most.
Explorations
Explorations allow us to build custom reports with data that aren’t available in the standard reports. This is where you can obtain detailed insights.
Go to Explore → Create a new exploration
Follow our configuration.
To add the metrics and dimensions, first click on the plus sign:
Then, type the names of the metrics or events related to your PDF. You can also look for parameters here.
Remember that there was a parameter called file_name. So we can type it there. Follow the same process for Metrics and Dimensions.
To see data in rows and columns, you can either drag the Dimensions and Metrics into the Rows and Values field in Tab Settings or double-click on them.
Let’s double-click on Event Count and Total Users. Then double-click on the File name.
You will get the following:
You’ll notice an annoying first row with empty data and that your file download data starts from the second row.
That’s because the first row includes all events other than file downloads (scroll events, video engagements, etc.). To remove this line, we’ll have to filter it out.
Under Tab Settings, go to Filters and click on Drop or select dimension or metric.
A small window will appear with the dimensions and metrics you added earlier. Select Event name. Go back to Filters, and click on Select match type. Select the Exactly matches option from the list.
Click on the Enter expression field and select file_download from the list.
This is what it should look like:
Click on Apply.
Done! You can click on the Event count column to sort the data in descending or ascending order. Your final exploration should look as follows:
Dismiss the total number of users here. This was just for illustrative purposes only as I was the only person firing these downloads.
DebugView and Realtime Reports
The DebugView and the Realtime reports allow you to see your PDF downloads as they happen in real-time. Those two reports are primarily useful for testing purposes. You can use them to check if your setup is working correctly.
This is how they will appear in the DebugView:
Most of the parameters attached to this event will be displayed, but for some reason, not all always do such as link_classes. However, you will find them when building Explorations.
This is how PDF downloads will appear in the Realtime report. Go to Reports → Realtime
You can click on the event and view more parameters.
Engagement Reports
You can get the Events under the Engagement reports. You can access it by following these steps: Reports → Engagement → Events
You should find your event listed in the table at the bottom. Click on it.
You may not see it if there are many events. In that case, type your event file_download in the search bar just above the table.
🚨 Note: If you just started tracking file downloads, you’ll probably not see them listed right away. Wait a day and they will be there.
You’d think that the Events report would be more useful, but apart from providing event counts (number of times PDF downloads occurred), gender, and geolocation data, you won’t find much more. This may change one day, so keep an eye on it.
PDF Link Tracking
A common mistake you’ll see over and over again, is to not track links (or not track them correctly) in PDF files.
Simply copying and pasting your site’s links into your ebook, whitepaper, and other PDF resources is unfortunately not enough to let you know which PDF directs users to which link on your site.
This is problematic, especially if your PDFs contain links to other products or services on your site.
Technically speaking, when a user clicks on a link in your PDF or any other file, Google Analytics can count their visit as a new session. As a result, it is not possible to know the source from which the user came. That’s only one reason why.
To remedy this problem, use UTM tracking to know which of your files is the source responsible for a given conversion.
This post explains how to track UTM in Google Analytics. You will even access our tool which will take care of generating and organizing the UTM links for you.
FAQ
How can I track PDF downloads in Google Analytics 4?
There are three main options to track PDF downloads in GA4:
1. Enhanced Measurement: Enable the File downloads option in the Enhanced Measurement settings within your GA4 account.
2. Google Tag Manager: Create a trigger and tag in Google Tag Manager to track PDF downloads. Disable the File downloads option in Enhanced Measurement to avoid double tracking.
3. Plugins: Use plugins like MonsterInsights to track PDF downloads if you prefer a simpler solution with straightforward reports.
How can I track links within PDF files?
To track links within PDF files and identify the source responsible for conversions, you should use UTM tracking. UTM parameters allow you to attribute traffic and conversions to specific PDF files.
Which option should I choose to track PDF downloads?
The recommended option is to use Enhanced Measurement for the fastest and easiest way to track PDF downloads. However, if you prefer customizing your tracking setup or already use Google Tag Manager, you can opt for that. Plugins are suitable when you have limited access to analytics configuration or need a simple solution with concise reports.
Summary
Tracking PDF downloads in GA4 isn’t complicated. Enabling the File downloads option in Enhanced measurement is, in our opinion, the best practice.
There are common exceptions that make this option not practical or possible (e.g., longstanding reliance on plugins, straightforward reporting, and limited permissions) and we’ve addressed them.
Because files can sometimes be accessed by clicking on a button, the next step to build on your skills is to learn how to track button or link clicks. Lastly, tracking is great, but as a digital marketer, the last step in the value chain is optimization.
Fine-tune your analysis by looking at downloads per traffic source and other types of segmentation. Make sure to follow SEO best practices for your PDFs, since Google indexes them.
The default File Download tracking in Enhanced Measurement for GA4 seems to truncate URLs at 100 characters? Our CMS makes long URLs, so most get truncated, making these reports useless. Is it possible to modify the way this works eg. to just store the filename and not the full path? Or can I create another custom event to store this somehow without double-counting them?
Have you looked at another parameter besides the link_url ? I’m not aware of your setup, but there are few things you can do. Since your URLs are truncated (which means you’ve checked for the link_url parameter), try to look at other parameters (such as link_text, this will return the text of the file download button or the linkable text). Another option would be to use GTM and send a parameter (that you can name with the name of your resource) and use variables such as Click text or (Click ID and Click classes for more robust tracking). I suggest… Read more »
Question: Will the suggested GA4 set up also track PDFs that are hosted in Hubspot rather than on WordPress?
PDF tracking is an incredibly common request from our clients and it is amazing that Google do not have it on by default and with easy to read reports. The solutions here all work but with far more effort than there should be. Users expect to be able to see these reports in the same way that page view reports work. The “Exploration” feature is terrible. Hard to use, unintuitive and you cannot give write access to your clients for reports you create for them.