How To: Set Up Google Event Tracking


  • By Staff
  • November 06, 2015
How To: Set Up Google Event Tracking

Google event tracking is additional code that allows you to monitor actions taken on a website (i.e., video views, forms completed, downloads, external link clicks, etc.) that cannot be tracked with standard Google Analytics (GA) code. It is useful when running a campaign whose success depends on specific actions taken on landing pages. 

It is also useful for general practice in understanding how users interact with your site or how and where they convert on the site.

How does it work?

Google event tracking allows you to assign categories to actions on your website so that you can monitor the data in GA under “Behavior > Events.” The code uses four main components in identifying actions, which are identified and organized by your team:
 
  • Category
  • Action
  • Label (optional, but recommended)
  • Value (optional)

For example, you might set up a video "play" button on your site so that it sends an Event hit with the following values:
 
  • Category: "Videos"
  • Action: "Play"
  • Label: "Baby's First Birthday"

Note: Check with your developer to see if regular GA is already enabled for your site. If not, you first need to set up regular GA tracking on your site (see instructions here) before enabling event tracking.


What are the best methods for naming?

Think through your entire usage of event tracking before naming your tags. For example, consider what your broadest term for classifying actions is and what the most detailed is.

Category is the broadest classifying component, so think in general terms what it is you’re trying to track. For example, if you want to review actions taken on videos, consider using “Videos” as a category name for all videos tags.

Action gets a little more specific. This is where you will name the type of event or interaction you want to track. For example, with a single "Videos" category, you can track a number of specific events such as:
 
  • Time it takes a video to load
  • Play button clicks
  • Stop button clicks
  • Pause button clicks

Note: You can duplicate action names across categories, but this will affect how data is collected. You might choose to reserve the term "click" for gadget interactions (like buttons or links), while keeping the action terms, "play," "pause" and "stop" reserved for video player interactions.

Label is the most specific. This is where you can actually name the video or whitepaper to be downloaded.
 
  • Category: "PDF"
  • Action: "Download"
  • Label: "/TEST/sales.pdf"

Value is optional. This is where you can assign a numeric value to a tracked object. For instance, you could assign a value of 1–5 (5 being the highest) for lead scoring, or measure the number of seconds for video load time.

The following table illustrates how data is aggregated in GA:





So how does this get implemented on your site?

In basic terms, the code is structured like this:

_trackEvent(‘category’, ‘action’, ‘opt_label’, ‘opt_value’)

If we put this code into action for a whitepaper download, for example, the code could look like this:

_trackEvent(‘whitepaper’, ‘download’, ‘How To Do Event Tracking’, 5)

If you want the event tracking to fire when a user clicks something on the site, put this code into an onClick function (code that triggers when a user clicks a button or link, etc.) and put it into the actual <a href> tag. 

Example:

<a href="/downloads/whitepapers/how-to-do-event-track.pdf"
onClick=" _gaq.push('_trackEvent', 'whitepaper,' 'download', 'How To Do Event Tracking', 5)'" target="_blank">How To Do Event Tracking Whitepaper</a>

If you have a Web development team or technical team that can handle the implementation of the code, then you just need to provide them with the entire event tracking onClick functions you want measured for the page or site and they can implement these into the code of the page.

Example of delivery:
 
  • onClick=”_gaq.push(‘_trackEvent’, ‘whitepaper’, ‘download’, ‘How To Do Event Tracking’, 5);”
  • onClick=”_gaq.push(‘_trackEvent’, ‘video’, ‘play’, ‘Baby’s First Birthday’);”
  • onClick=”_gaq.push(‘_trackEvent’, ‘Email Signup’, ‘click’, ‘MSP-C Weekly eNews’, 3);”

Where can you go for more information?

For more information about event tracking on non-click functions (e.g., form completion progress or scroll reach), go to this blog. Good luck and enjoy the new intelligence you gain on the actions taken within your site.

P.S. If you’re looking for a more “managed” approach to building and executing your website tags, try Google Tag Manager.



Written by Carly Reynolds and Isabelle Wattenberg

Want more like this? Sign up for our monthly e-newsletter!