How to track PDF downloads in Google Analytics

How to track PDF downloads in Google Analytics
Want to track how many times visitors download PDFs on your website? In this article, we’ll look at several ways you can set up Google Analytics to properly track PDF downloads.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

We love using Google Analytics to track how people are interacting with our website, but by default Google Analytics 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 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: 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 2: 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 3: 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

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

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

Analytics Event - PDF view in Google Tag Manager

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

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.

PDF View Goal in Google Analytics

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

How to view PDF downloads in Google Analytics

To view file downloads, log in to your Google Analytics 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.

Top Events in Google Analytics

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?

If you’re still stuck and can’t track PDF downloads in Google Analytics, 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.

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

  1. Avatar

    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?

    1. Ben Matthews

      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.

Leave a Comment

Your email address will not be published. Required fields are marked *

Subscribe to the empower newsletter

Get updates from the empower team

Read these next...

5 steps to run successful local PR and media campaigns

If you run a local business or have a product or service that requires focussing on specific local areas of the UK, you can benefit hugely from building relationships with local media and running a local PR campaign.

Charity Digital and Tech For Good Events Calendar 2020
Blog
Ben Matthews

Charity Digital and Tech For Good Events Calendar 2020

The Charity Digital and Tech For Good Events Calendar is a comprehensive guide to tech for good events for digital and tech professionals working in the charity and nonprofit sector, who are looking for events and conferences to attend in 2020.

10 Digital Marketing Trends to Watch

The digital marketing landscape continued to change and evolve in 2016, but with 2017 right around the corner we thought it would be useful to highlight some of the digital marketing trends we’ve spotted coming down the tracks.

10 digital marketing highlights

With so much happening throughout the agency in 2016, we asked the Empower team what their highlights from 2016 were. We’ve also looked back through the Empower blog to pick out the most read and most shared articles we’ve published in 2016. Here are our favourite moments of the year, with plenty of links to help you with your digital marketing into 2017.

How can we help you?

We’d love to hear from you. Send us a message and we’ll get back to you within 24 hours.