Track File Downloads in Google Analytics

Google Analytics doesn’t automatically track downloads of PDFs, Word and Excel documents, videos, or other files from your website. The Google Analytics tracking code relies on JavaScript, which can’t be embedded into these documents.

Fortunately there are a few ways you can configure Google Analytics to track file downloads.

1) Use Events to Track Downloads

Each time a visitor clicks a link to download a file, an entry will be added to the the Events report section. You are also able to define 3 descriptive segments for the event (category, action, and label). Sites that use Universal Analytics sites use different JavaScript functions than sites that use the traditional ga.js – for more information, see the “About Events” help article.

2) Use a Virtual Pageview to Track Downloads

Each time a visitor clicks a link to download a file, a pageview will be sent to Google Analytics and the downloaded file will appear in the Content reports. For more information, see the “Syntax Comparisons” help article.

The Problem: Direct File Downloads

The above configuration options require a visitor to click a link on your site to download a file. But when a document is directly linked from another site, Google Analytics isn’t able to track the download because the tracking code doesn’t run. This applies to files that are directly linked from a blog, a search engine, an email, or any website.

Here’s an example: go to and search for “form 1040” (or click the following link):

The top search result links directly to a PDF on the website. If you click the search result, you’ll load the PDF directly in your browser and bypass any JavaScript-based tracking.

The same thing happens if you click this link:

The IRS website uses Google Analytics, and they won’t be able to track your click because the PDF file is accessed directly.

(someone should tell the IRS about this problem)

The Solution

Many organizations use 2 web analytics tools to get a complete picture of website activity. In this case, we recommend using Google Analytics in tandem with Angelfish Software. Angelfish shows the true number of downloads (linked and direct), shows the websites that link directly to files on your site, and can upload this data as an event to your Google Analytics account.

Angelfish also provides details that aren’t shown in Google Analytics and is ideal for any internal / external website or web-based application, like SharePoint, Blackboard, Oracle, and more.

For more information, visit the Angelfish Software website