> starter’s guide – definitions and practical guidelines
What and why :
Google Analytics offers you a method for recording user interaction with any website elements, including the in-page actions that do not generate pageviews :
- Flash-driven elements (Flash website or Flash movie player)
- Embedded Ajax page elements
- Files downloads
- Loads time for data
- Page gadgets
This event activity is reported separately from your pageviews activity : you can find it in the Content > Events section of your GA dashboard.
An important consideration with tracking events is its impact on page bounce rate : with no events being tracked, a bounce is a single page visit – whereas with setting up Events tracking, a page with any triggered event is no longer considered a bounce. Indeed a bounce is generally considered as a bad experience for users, but if the page in question has interactive elements the user can view or use, then they might have a great experience on one single page ! Or course if the bounce rate remains quite high, this may tell you your widget or Flash element is no good match for your audience…
Setting up Event Tracking :
Start with defining your Events reporting structure :
Call the _trackEvent method in the source code of a page object, widget, or video :
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
As you can see there are 4 _trackEvent parameters :
- category > the name you supply for a group of items you want to track.
A category is the root level for the hierarchical structure of event tracking, allowing you to group identical actions.
- action > a string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object, for ex. a visitor’s mouse click.
- opt_label > An optional string to provide additional dimensions to the event data.
The label allows you to provide extra info about the data you want to track, such as the video title or file name. And if you have multiple events within the same category and action names, use label to differentiate.
- opt_value > An integer that you can use to provide numerical data about the user event.
This parameter is used to assign a numerical value for the tracked event : for ex. you can specify the play time (how much of a video has been watched in seconds, minutes or percentage), load time (how long a page takes to download) or revenue (a monetary value assigned to the triggered event).
- opt_noninteraction > a boolean that when set to “true”, indicates that the event hit will not be used in bounce-rate calculation. When this is set to true the event is non-interacting. When left undefined it defaults to false.
This could be used for ex. if you wish to track a visitor’s clicking forward or backward through an image carousel, and yet you don’t want these actions to affect the bounce rate of your site : in other words if this parameter is “true” and if the user interacts with the carousel but doesn’t visit any other page, this will be counted as a bounce.
The _trackEvent function might be implemented within your website pages source-code. Here’s a simple example that illustrates how you might use the Event Tracking method to record user interaction with a video Play link on your page :
<a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);">Play</a>
Note that text-string values for your events parameters (category, action) are case sensitive : that is, the “Play” action will be reported separately from the “play” one.
Defining Events actions :
As we said it earlier, the action parameter defines the interaction you wish to capture from a visitor. You can use the following triggers :
- Play, pause, stop – button clicks
- Time – how long it takes to add to cart, how much of the video is played…
- Resize, zoom – manipulating an image
- Select, change, drag, drop – manipulating an object
- Click – click-through on a download link or banner
The important thing to remember, is that if you want the Event to fire data when someone clicks something, you will need to put the code inside an onClick function, as shown below :
onClick=”_gaq.push(['_trackEvent', 'whitepaper', 'download', 'SEO is great', 5, true]);”
The onClick item can obviously be replaced by the trigger of your choice : onSubmit, onMouseOver, onKeyPress, onMouseOut, onMouseMove, onReset, and so on…
And of course the Event may be attached to the items it reffers to, whether a link, a button, an image carousel or a video – check out this full extra example for tracking clicks of a PDF :
<a href=”/downloads/whitepapers/analytics-is-great.pdf” onClick=”_gaq.push(['_trackEvent', 'whitepaper', 'download', 'GA is great', 5, true]); ” target=”_blank”> Google Analytics Is Great Whitepaper</a>
Structuring Events tracking :
You have to remember that defining your Events reporting structure is essential for effective results : first plan, and then implement !
Here are some practical example of how you should plan your Events structure :
Implicit count :
In Event Tracking, each interaction with a tracked web page object is counted and associated with a given user session. In the reports, Total Events are calculated as the total number of interactions with a tracked web page object.
For example, if one user clicks the same button on a video 5 times, the total number of events associated with the video is 5, and the number of unique events is 1.
Other best practices :
In any case, it’s recommended to avoid tracking Events that generate huge amounts of Events, that is :
- Avoid scripting a video toto send an Event for every second played.
- Avoid excessive mouse movements tracking.
- Avoid time-lapse mechanisms that generate high event counts.
Indeed there’s a limit of number of Events that can be tracked during a visit : the maximum is 500 combined GATC requests, both events and pageviews. Remember that events can rapidly accumulate for a visitor’s session…
Also you may know that Events can be set up an Event as a Goal, in which case you can assign a monetary value to the conversion.
Extra resources :
My selection of quality posts for further reading :