Google Analytics Hacks: Tracking File Downloads As Goals

If you are using Google Analytics for tracking your website performance or user activities, you should know that under standard implementation Google Analytics will not track certain user interactions, including downloading files (e.g., product catalogs, brochures, trial software, etc) and interaction with media players (e.g., embedded flash player for product demos).

Event Tracking and Virtual Pageviews are the two techniques you can use in such scenarios. In this article we will learn how to leverage the concept of Virtual Pageviews in Google Analytics to track file downloads and then setup Goals to further analyze this user interaction.  Just to clarify, you can also use Event Tracking to track file downloads. However, you cannot measure file downloads as Goals when you use Event Tracking. The difference between Event Tracking and Virtual Pageviews is covered in great detail with hands-on examples in our Google Analytics  Advanced Courses.

Tracking File Downloads using Virtual Pageview:

Step 1:

You  need to change your website code such that Google Analytics will start capturing file downloads. Let’s assume that you have links on your website to download your  services catalog. For example, your original link for downloading the services catalog may look like:

<a href=”http://www.example.com/srvcatalog.pdf”>Download Our Services Catalog </a>

You will need to modify the above link as follows:

<a href=”http://www.example.com/srvcatlog.pdf” onClick= “pageTracker._trackPageview (‘/downloads/ServiceCatalog/srvcatlog.pdf’);”> Download Our Services Catalog </a>

In the above example, I am calling the trackPageview method by using an onClick event in JavaScript. The argument that I am passing through the trackPageview method is allowing me to create a pseudo pageview in Google Analytics. I recommend that you use an appropriate tree structure that will make your reports more intuitive to read and analyze.

Step 2:

Now let’s setup a Goal in Google Analytics which will allow you to measure how many times your services catalog was downloaded. Most importantly you can build a funnel around this user activity to understand what motivates people to download your services catalog.

Within an appropriate profile, navigate to the Goal Settings page and use the following configuration to setup a Goal for the above example :

Goals for Virtualpageview in Google Analytics
Goals for Virtualpageview in Google Analytics

You can use Goal Value to monetize this Goal.  Click on the Save Goal button to save your Goal and exit the Goal Settings page. Google Analytics will now track and record your services catalog download as Goals and will allow you to analyze this user activity via six different reports available under the Goals section. If you are new to the concept of creating Goals in Google Analytics then we cover this topic in great detail with hands-on examples during our Google Analytics Course.

Get the latest updates on our blog, classes, and tutorials by subscribing to our free newsletter. Click here to sign up.

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.


8 thoughts on “Google Analytics Hacks: Tracking File Downloads As Goals”