Empowering government to build better resident and employee experiences and get more value out of their civic engagement technology.

Learn More
Back To Blog

How to Track What Happens After the Click


By: Thomas Francisco, Engagement Specialist

While, Google Analytics doesn’t automatically track file downloads, the good news is that getting it to track downloads doesn’t take a tremendous amount of effort on your end. Check out my last post on “Tracking, Measuring and Reporting What Happens After The Click: Measuring Your Most Effective Communication Channels” for more background on website reporting.

Before we get into the nitty gritty of how to setup click tracking, there are a couple of prerequisites that are necessary. You must have a working knowledge of HTML in order to make these changes to your web pages. In addition, you’ll also need to have the ability to make said changes to your webpages and to your Google Analytics account.

Note: The method outlined below is for use with the ga.js tracking code and not for use with the analytics.js tracking code. For details regarding Event Tracking with analytics.js see Google’s documentation.

Event Tracking is a method available in the ga.js tracking code that you can use to record user interaction with PDFs, videos, file downloads, and form submissions; essentially any non-webpage. This is accomplished by attaching a “method call” to the particular UI element  you want to track. When used this way, all user activity on such elements is calculated and displayed as Events in the Analytics reporting interface.  In order to track the requested elements, you need to update both the HTML of the source page/element as well as the Google Analytics account.

GAConfig is an amazing tool that will help you generate the script needed to be added to your webpage, document URLs and external links in order for them to be properly tracked in your Google Analytics account. The method outlined below is for setting up events tracking in Google Analytics for file downloads. Consult either GAConfig or Google Analytics documentation for steps needed to track videos and form submissions.

1. Set up tracking on your site. Make sure you have set up tracking for your website.

2. Call the _trackEvent() method in the source code of requested pages and documents:

The specification for the _trackEvent() method is:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)

  • category (required) The name you supply for the group of objects you want to track.
    • In the example link below: Download
  • action (required) A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.
    • In the example link below User Guide
  • label (optional) An optional string to provide additional dimensions to the event data.
    • In the link below 2014 Community User Guide
  • value (optional) An integer that you can use to provide numerical data about the user event.
    • In the example link below Version2
  • non-interaction (optional) A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation.
    • Can be only true or false as a value.

Example: <a href=”/downloads/example-userguide.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘Download’, ‘User Guide’, ‘2014 Community User Guide’, Version2, false]);”>Download PDF</a>

The link found above will need to be added to your website as well as used in any email messaging sent out linking to this document. Once you’ve properly set up and coded your links, all that is left to do is set up the event as a conversion goal in Google Analytics. To do so you:

1. Open up the profile you wish to set up the goal in. thomas3

2. Click the gear icon in the upper right corner of the Google Analytics interface.

3. Click the Goals tab (in the sub-navigation just below where your Profile is listed).

4. Choose the Goal Set you wish to add the event to.

5. Name your goal and select the Event radio button.

6. Populate the following goal details:

  • Category (matches same as above)
  • Action (matches same as above)
  • Label (matches same as above)
  • Value (matches same as above)

7. If you’ve added a Value in step 1, leave the “Use the actual Event Value” radio button selected.

8. Click “Save” and you’re ready to go!

Did you know?

By utilizing a Custom URL you can track even more detailed conversions through your email newsletters, press releases, or marketing promotions. While Event Tracking gives you an overall picture of the effectiveness of individual communication channels, a custom URL gives you insight into the effectiveness of individual instances of communication. As such, you can see which tweet, newsletter, or Facebook share garnered the most engagement with your stakeholders.