PDF Analytics in Google Analytics

Please note we cannot provide any support or troubleshooting for this plugin and will likely no longer work when Google Analytics 4 arrives.

The holy grail of content tracking: Track visits to your website’s PDF files in Google Analytics, Plus a Free WordPress Plugin.

TL;DR We’ve created a WordPress plugin that tracks PDF views on your website, in Google Analytics. It’s free, and unlike other solutions, captures 100% of traffic (including Direct and Organic Search)

How do you track Google Analytics data on PDF files?

With 7 out of 10 websites using Google Analytics, it clearly holds the title of the most popular Analytics platform.But one major downside in how Google Analytics works is that it can only track visits to the HTML pages on your website. Unlike previous generations of Web Analytics packages that relied on Log File data, GA cannot see traffic landing directly on your other media files, including the enterprise and public sector favorite, PDF.

The reason for this issue is that Google Analytics uses JavaScript to track visits, which only works on web pages. Images, videos, Microsoft Office documents, and PDF files do not execute JavaScript and fall into a black hole. In the past, the recommended solution was to tag internal links to these files, so that Google Analytics could assign a view/touchpoint. This only records a small fraction of views though, and none of the traffic from search engines, email clicks or links from third parties.

Finance, insurance, and public sector websites are particularly affected by this problem. Important information, data, forms, product/service details, and brochures all get delivered in PDF format. These institutions do not want to convert their PDFs into webpages, as they can’t be easily controlled, versioned, and compliance checked. Even those that do convert usually link to and promote a PDF version of the information.

Restaurants also favor PDF files for their food and drink menus but cannot see if anyone downloads or reads them.

I’ve seen this firsthand with several clients that had PDF documents ranking competitively in Google. None of this traffic was measurable though. The solution was to build “PDF Analytics,” a plugin for WordPress that makes those visits visible in Google Analytics for the first time.

PDF Analytics - Settings Page

PDF Analytics intercepts any request for a .pdf file on your website and collects the visitor’s Google Analytics cookie data (if any), UTM tracking tags in the URL, and several other metrics. These are then sent to Google Analytics via their official API. The PDF file is then served as usual, from the same URL and without the visitor knowing any different.

To make it fast and reliable, the PDF tracking script runs independently of WordPress. So your PDF files are still accessible if your WordPress database goes down or has an error, plus isn’t affected by any problem-plugins that might otherwise slow it down. It does not “phone home” to me or any third party other than Google Analytics itself, so will pass corporate compliance and security audits.

If that wasn’t enough, I’m releasing the plugin for free! Just click here to download the ZIP file, then upload it to your WordPress site under “Plugins” > “Add New” > “Upload”. Then “Activate” it and enter your Google Analytics Tracking/Site ID on the settings page.

If you’d like to say thank you, please share a link to this announcement with anyone that you know, who uses WordPress and Google Analytics.