This document assumes familiarity with Google Analytics Tracking
Code (GATC) configuration. Additionally, you must have
ga.js tracking code installed on those pages where
you configure Event Tracking as described here. For more information
on tracking your site using the GATC, see
Event Tracking is a method available in the
tracking code that you can use to record user interaction with website
elements, such as a Flash-driven menu system. This is accomplished by
attaching the 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. Additionally, pageview calculations are unaffected by user
activity tracked using the Event Tracking method. Finally, Event
Tracking employs an object-oriented model that you can use to collect
and classify different types of interaction with your web page
ga.js, you would commonly apply Event Tracking
- Any Flash-driven element, like a Flash website, or a Flash Movie player
- Embedded AJAX page elements
- Page gadgets
- File downloads
The design model for Event Tracking is highly flexible, and its use can be extended well beyond the common model of user-triggered events—the design decision is up to you. For this reason, useful Event Tracking reports require collaboration with your report users and good report planning.
- Determine in advance all elements for which you want to track data.
Even if you initially track only a single object on your website, having an overall sense of the various objects/events you want to track will help you establish a report structure that scales well with an increase in the number and type of Event Tracking.
- Work with your report user to plan your Event Tracking reports.
Knowing in advance how the reports should look will direct the structure of your Event Tracking implementation. For example, if the reports only need to show video UI interaction, your category structure will be quite different than if the reports need to track other Flash UIs like menus, embedded gadgets, and load times. In addition, you can inform the report user about the different tracking possibilities available with Event Tracking to get the most out of your implementation. For example, the report user might be interested in tracking user behavior on a Flash video interface, but might also be interested in latency tracking for the load time of the video. In that case, you can plan ahead to have meaningful names in your event calls.
- Adopt a consistent and clear naming convention.
In the process of implementing Event Tracking, every name you supply for categories, actions, and labels appears in the reporting interface. In addition, a category/action pair is treated as a unique element in the report statistics, so consider first how you want your metrics to be calculated for all objects belonging to a similar category.
Setting Up Event Tracking
Before viewing event tracking results in your reports, you must set up event tracking on your site:
- Set up tracking on your site. Make sure you have set up tracking for your website. For information on setting this up, see the Tracking Basics guide.
- Call the
_trackEvent()method in the source code of a page object, widget, or video.
The signature of the
_trackEvent()method is as follows:
_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)
The name you supply for the group of objects you want to track.
A string that is uniquely paired with each category, and commonly used to define the type of user interaction for the web object.
An optional string to provide additional dimensions to the event data.
An integer that you can use to provide numerical data about the user event.
A boolean that when set to
true, indicates that the event hit will not be used in bounce-rate calculation.
- View the reports. Once event tracking has been set up and working on your site for a day, go to the Content section of the reports and view Event Tracking.
To learn more about events and event tracking, read: