How to track PDF downloads in Google Analytics 4

Ben Matthews

By Ben Matthews

In Google Analytics

Reading Time: 6 minutes

We love using Google Analytics 4 to track how people are interacting with our website, but by default Google Analytics 4 will not track how many times people download PDFs or other file types.

This simply because those files do not have the ability to request a tracking pixel, which is the method Google Analytics 4 uses to track what people are doing on your website.

A few benefits of tracking PDF downloads are:

  • Discover how popular your downloadable PDFs are
  • Find out which content type you should offer more and which aren’t getting downloaded much
  • Save your time and money by only producing the PDF content your audience actually wants

In this article, we’ll look at several ways you can set up Google Analytics to properly track PDF downloads. Some of the methods are easier than others, so have a read through and check which method is best for you.

Method 1: Google’s Official GA4 Method

In Admin, under Data display, click Events.
Click Create event and then Create.

In the Custom event name field, enter the name “white_paper_download”.

In the Matching conditions section, enter the first matching condition “event_name” equals “file_download”, then click Add condition.

Enter the second matching condition “file_name” equals “My White Paper”.

Click Create.

To measure when someone completes a registration form as a conversion:

In Admin, under Data display, click Conversions.
Click New conversion event.

Enter the name of the new event, “white_paper_download”.

Click Save.

Method 2: Adding a script to the PDF download link

If you are linking to a PDF that opens in a new window (by using target=”_blank” for example), then the tracking code is fairly simple to implement.

Your link will look something like: <a href=”/my-file.pdf” target=”_blank”>Download the PDF</a>

To properly track this in Google Analytics, add the following code to link tag:

<a href=”/my-file.pdf” target=”_blank” onclick=”_gaq.push([‘_trackEvent’,’Download’,’PDF’,this.href]);”>Download the PDF</a>

When a user clicks to download your file, a tracking pixel is requested and recorded in your Google Analytics.

That solves the problem for individual PDF downloads, but what if you want to track any PDF download on your website?

Method 3: Using a WordPress plugin

Many of our clients have built their websites using WordPress, so luckily for them there are a range of WordPress plugins that allow you to track PDF downloads.

To enable PDF downloads tracking, we recommend using a WordPress plugin like MonsterInsights.

After installing and setting up the plugin, file downloads tracking will be enabled automatically and they will be tracked as events. But the good part is that you don’t have to do any further configuration, as MonsterInsights will take care of it.

By default, MonsterInsights lets you track downloads of the following file extensions: doc, pdf, ppt, zip, xls, docx, pptx, and xlsx. But you can add more extensions that you want to track.

In Google Analytics, events tracking are used to measure user interactions with content like downloads, mobile ad clicks, video plays, etc.

Method 4: Google Tag Manager

If your website isn’t built on WordPress and you want to track all PDF downloads, not just individual PDFs, you’ll need to use Google Tag Manager.

Google Tag Manager allows you to add tags to your website that can be associated with almost any element – buttons, time on a page, clicks.

The video below describes how to install Google Tag Manager, as well as an introduction to the software, but there are also written instructions for how to install Google Tag Manager here.

There are three main components of Google Tag Manager:

  1. Rule – A name given to a condition or set of conditions
  2. Tag – Triggers an event when a rule is met
  3. Container – the “box” that holds all your rules and tags

Before you can measure PDF views, you need to first ensure that anytime someone clicks a link on your website, that click is tracked: a Link Click Listener tag accomplishes this.

  1. In your Container Overview menu click New » Tag and name the tag “link click listener”
  2. Under “Tag Type” select Event Listener » Link Click Listener
  3. On the right hand side of the screen, click “+Add” next to “Firing Rules” and select “All pages”
  4. Google Tag Manager creates the “All pages” rule automatically
  5. Save

This creates a tag that says, via code, “On all pages of this website, whenever someone clicks on a linked element, I will create an event called gtm.linkClick.”

Link Click Listener in Google Tag Manager
Link Click Listener in Google Tag Manager

Now that you’re measuring all link clicks on your website, you need to hone in PDF clicks specifically, which means creating a new rule to identify PDF clicks.

  1. In your Container Overview menu click New » Rule and name the rule “PDF click”
  2. Under “Conditions” select {{event}} » equals » gtm.linkClick.
  3. Remember, gtm.linkClick is the item generated by your Link Click Listener tag
  4. Add another condition – {{element url}} » contains » .pdf
  5. Save

This creates a rule that is only met when someone clicks on a link with .pdf in the url string.

PDF Click in Google Tag Manager
PDF Click in Google Tag Manager

Next you’ll need to create a “PDF View” tag. This tag will add an event to your Google Analytics account anytime someone clicks on a PDF.

  1. In your Container Overview menu click New » Tag and name the tag “Analytics Event – PDF View”
  2. Select “Tag Type” Google Analytics » Universal Analytics
  3. Add your Google Analytics tracking ID to the “Tracking ID” box
  4. Under “Track Type” select Event
  5. In the “Event Tracking Parameters” assign the following names. These will help organise events within Google Analytics as you add more tags):
    Category – micro-conversion
    Action – {{element url}}
    Label – pdf-view
  6. Click “+Add” next to “Firing Rules” and select “pdf click”
  7. Save

Now you’ve installed the tag, you can test they’re working using the following step-by-step:

  1. In the upper-right corner of your Container Overview menu click Preview » Debug
  2. Visit your website in a new tab
  3. Click on a PDF on your website
  4. If the menu bar below reads “Tags Fired on this Page: Analytics Event – PDF View,” then you’re set.
  5. If not, go back and look for mistakes. A single typo or space can stop the tag from firing correctly.
  6. Exit debug mode.
PDF view tag firing in Google Tag Manager
PDF view tag firing in Google Tag Manager

Now the tag has been added and tested as working correctly, you can create a “PDF View” goal in Google Analytics:

  1. In your Google Analytics account, select “Admin” from the primary navigation.
  2. Select the property (whose tracking code you used in Google Tag Manager) and the view you want to create the goal in.
  3. Click Goal » New Goal, name the goal “PDF View” and select event under the “Type” menu. Click next.
  4. Under “Event Conditions” set category » equals to » “micro-conversion” and label » equals to » “pdf-view”
  5. Save.

You can You can now track PDF views as a goal within this Google Analytics view.

How to view PDF downloads in Google Analytics 4

To view file downloads, log in to your Google Analytics 4 account and select the website where you’d like to track file downloads.

If you’ve enabled downloads tracking as page views, you can find out the downloads report in the All Pages report along with other blog posts and pages.

This report can be accessed by navigating to Behaviour » Site Content » All Pages.

If you’ve enabled downloads tracking as events, you can see the downloads data in your events report.

In your event reports, navigate to Behavior » Events in the left panel. You’ll now see four different options.

  • Overview: It gives you a summary of top events data of your site
  • Top Events: It shows you a list of events that keep your visitors engaged on your site
  • Pages: It shows you a list of pages in which your downloadable resource is hosted. In other words, it is a list of posts and pages where the events occur on your site.
  • Events Flow: The events flow report helps you discover which events keep your visitors engaged with your site. It also visualizes the path users take from one popular event to another.

To get a detailed report, click on Top Events.

Then, click downloads to get a detailed report.

If you would like to see the full report on your Tag Manager events, click on the Behavior –> Events –> Overview report in the sidebar of Google Analytics. The Event Action report will show you the exact URLs of the downloaded PDFs.

Need help with how to track PDF downloads in Google Analytics 4?

If you’re still stuck and can’t track PDF downloads in Google Analytics 4, leave a comment below and we’ll see if we can help.

Empower also runs Google Analytics training for charities, so take a look at our offering if your charity needs an extra hand in understanding the data from your website visitors.

22 thoughts on “How to track PDF downloads in Google Analytics 4”

  1. All of these solutions surely only track clicks on links to PDFs, rather than visits to the PDFs themselves? What if a user bookmarks the PDF URL, or navigates to it via search engine or link in an email, etc?

    Reply
    • Hi Mike, yes that’s just for clicking on links. Unfortunately you can’t track visits if a user bookmarks the PDF URL, or navigates to it via search engine or link in an email.

      If you send email newsletters using a service like Mailchimp, you can track links clicked that way.

      Or you can host the PDF on a platform like Slideshare or Scribd, which gives you analytics of how many people have viewed the PDF.

      Reply
  2. Is this outdated now?

    One of the steps you describe is:
    “Under “Tag Type” select Event Listener » Link Click Listener”

    However, at this step GTM doesn’t seem to offer “tag types” as an option. It just offers ‘tag configuration’ and ‘triggering’

    Reply
    • Thanks for letting us know, we’ll update the post shortly.

      “Triggering” would be the option to select now.

      There are two types of click triggers in Google Tag Manager: “All elements” and “Just links.”

      All elements trigger tracks clicks of any element (link, image, button, etc.), while Just links trigger tracks link clicks only.

      Reply
  3. There is no such thing as ‘Event Listener » Link Click Listener’ in google tag manager? nowhere to be found. these are the available values.

    Google Analytics: Universal Analytics
    Google Marketing Platform
    Google Analytics: GA4 Configuration
    Google Marketing Platform
    Google Analytics: GA4 Event
    Google Marketing Platform
    Google Ads Conversion Tracking
    Google Ads
    Google Ads Remarketing
    Google Ads
    Floodlight Counter
    Google Marketing Platform
    Floodlight Sales
    Google Marketing Platform
    Conversion Linker
    Google
    Google Optimize
    Google Marketing Platform
    Google Surveys Website Satisfaction
    Google Marketing Platform

    Reply
  4. Yes, your detail has helped me to setup my website for analytics, i was now able to solve my issues, but everything is now working well. Thanks for your support, subscribed your blog..

    Reply
  5. Hello – When following method 1 – whereabouts do I find this data in Google Analytics?

    “When a user clicks to download your file, a tracking pixel is requested and recorded in your Google Analytics.”

    Reply
  6. Hello, is it possible to track different PDF downloads from different parts of a website or does the total always lump all PDF downloads across the entire site together? If it is possible, how do you do it?

    Thanks.

    Reply
      • I would also like to know this.
        On the website I am tracking now I noticed that when I name the link to the pdf differently, for example “info about abc” and the next link “info about def” then I get the data for each link/pdf.
        Although I have a few links to different pdfs with the same name, like “here”… then I get a consoludated count for “here” and not what pdf was actually downloaded. I hope that makes sense… but I would really like to know what pdf was downloaded when some clicks “here” instead of the consoludated data. Otherwise that means that I will have to update the links “here” to each an individual name.

        Reply
  7. Hi Ben, I also have the same issue other people are having in that I can’t find “Event Listener » Link Click Listener” in google tag manager.

    I was going to choose “conversion linker” but it sounds like that is for external links only. I want to see how many people have clicked a link of a pdf (without downloading it) that is in my media library.

    Will Conversion linker still work?

    Thank you
    Narelle

    Reply
  8. Hello Ben Matthews,

    Thank you for the article. It’s insightful.

    I do have a one query though. I am a marketer where my team is executing an email campaign, in which we are sharing a PDF Google Drive link, which is set to view for all.

    How do we track who viewed this link on Google Analytics?

    We are not able to add utm parameters to the PDF Google Drive link. We want to be able to check how many of our prospects/recipients clicked on the link and viewed it.

    Request you to help us out here.

    Thanks,
    Karuna

    Reply
  9. Hello – but how do we track pdf downloads, if lets say a user click on the link and views the pdf that opens on a new tab and than decides to dowload by clicking on the download icon on the top right. Is there a way to track these actual downloads?

    Reply
    • Hello, unfortunately there’s no way of tracking PDF downloads when they open a new tav and click download from the browser, as this interaction takes place off the website and directly in the browser. You can only track how many people click on the link on your website.

      Reply

Leave a Reply to Susan Cancel reply