Skip to main content

Do you have a web activity on your website you want to be able to measure and track? Many sites have purposeful actions related to visitors activities, their sales process or after market support for example. While traditional pageviews or ecommerce conversion are more straightforward to understand and measure, other related events like a download of a support document, or video message may not be properly “counted” or tracked as a pageview in Google Analytics. This is when it’s time to implement a great Google Analytics feature called Event Tracking.

Event Tracking allows you to track visitor actions that don’t correspond directly to pageviews. It’s a great way to track events or activities like:

  • Downloads of a PDF or file
  • Interaction with dynamic, AJAX sites
  • Interaction with Adobe Flash objects
  • Play of embedded videos and other media

Unlike virtual pageviews, Event Tracking will not alter your pageview count. This makes it the preferred method for tracking the interaction of visitor actions as noted above.

With Google Analytics, an event consists of:

  • Category: something being tracked, for example, “video.  The Category is used as the highest level tracking.  This means it ties together all the other variables and should not be too unique per line.  It is required.  This means if you are tracking a series of events, you would keep this the same per event page or action.  If you are tracking a web form for instance, then keep all of these the same wording like “Web Form” so they are grouped together.
  • Action: an activity or interaction for example “play”. The Action is used to track the type of so called ‘actions’ the web surfer is taking.  So for this example, you would use “Viewed Form” or “Completed Form” or “Video Played” or something similar.
  • Labels: an optional attribute, for example, “President’s Message”. The label is used to show additional info about the event you are tracking.  It is kind of like giving a page a title.  In this case this could be “Played Video Message” or “Filled Form Out” or “Error On Form”, or it could just be “Form Page”.
  • Values: use it to assign a numerical value to a tracked page object. For example, you could use it to provide the time in seconds for an player to load, or you might trigger a dollar value when a specific playback marker is reached on a video player. This is great for counting or summing things up like download time.

Before inserting the event tracking code, as a reminder, the basic Google Analytics code looks like this:

<script type=”text/javascript”>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(“%3Cscript src='” + gaJsHost + “’ type=’text/javascript’%3E%3C/script%3E”));

<script type=”text/javascript”>
var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
} catch(err) {}

Before starting to use event tracking a quick look at the syntax and the way you can use it reveal that the tracking code should look something like this:

_trackEvent(category, action, (optional) label, (optional) value)

Here’s an example of the event tracking code to track Videos as the Category, Play as the Action, and President’s Address as the Label.

<a href=”#” onClick=”_gaq.push([‘_trackEvent’, ‘Videos’, ‘Play’, ‘President\’s Address]);”>Play</a>

This code would track how often a video was played on a site.

With videos that are viewed on site you can not only track if visitors clicked to play them, but also if they were paused or stopped half way through. This information will provide you insight on how useful your content is and may highlight areas in content that may need updating to make the site more engaging and relevant to what your visitors are looking for. In this way you can be sure to know how valuable your support documents, downloads and videos are to your site visitors as well as the overall website conversion process.

For more information on setting up event tracking and related Google Analytics Consulting Services, please contact us today!