Jump to content

How to Track Events with Google Analytics

+ 1
  chco's Photo
Posted Aug 25 2010 11:37 AM

Tthe following excerpt from Google Analytics explains the ways you can track how people interact with the content on your website.
There is a new paradigm taking shape in the world of web analytics. For a long time, the most granular piece of data we collected was the pageview (Figure 10-14). However, with the onset of new technologies, like Flash and Ajax, and the addition of new content types, like movies and widgets, pageviews no longer provide the necessary data to understand user actions.

Figure 10-14. The old web analytics data hierarchy

Attached Image

We need a new, more granular piece of data that describes how visitors interact with our content. In Google Analytics, that new piece of data is called events.

Events are actions that visitors take on a web page that don’t generate new pageviews. Interacting with a video player, a widget, or an audio player are all common events that you can track with Google Analytics.

In the old days (i.e., 2008!) we could track this data as a virtual pageview, but this is really ineffective for two reasons. First, it creates lots of pageviews that pollute our true pageview numbers. Second, the reporting wasn’t built to handle events, so it doesn’t provide any real insight. That’s why we have event tracking.

Event tracking adds another layer of data to the visitor data hierarchy, shown in Figure 10-15.

Figure 10-15. The new web analytics data hierarchy, which includes events

Attached Image

Now we can really get a good idea of how visitors are engaging our interactive content. This will be vital as web technologies, like Ajax and Flash and mobile apps, continue to evolve.

Events do not create a lot of new metrics in Google Analytics. Basically, Google Analytics counts how many events occur. All events, and the attributes of events, are recorded as dimensions in Google Analytics. This makes is possible to perform advanced analysis using events in custom reports and advanced segments.

If you’re wondering how you might use events, consider the following:

Social media tools

If you’re embedding social media tools on your site, you can use event tracking to measure whether people are using these tools. Figure 10-16 shows how REI allows visitors to share content using a number of different social media platforms. Capture clicks to evaluate whether visitors use this type of feature and the ways they like to share.

Embedded video

If your website uses video, you can measure almost all aspects of a video player using event tracking. Start with the basic commands—capture how many times the player loads and how many times the video ends, along with other interactions with the player features (play, pause, skip, etc.). Don’t forget to measure which videos people watch and, if you run ads during the videos, use the value field to collect revenue information.


Many financial sites contain some type of calculator, like the mortgage calculator shown in Figure 10-17. You can easily track these with event tracking. Use events to capture the various values visitors enter into the calculator, thus providing some insight into visitor needs. Remember, it is against the Google Analytics terms of service to capture any personally identifiable information.

Figure 10-16. Capture different sharing options using event tracking

Attached Image

Figure 10-17. You can track online calculator activity with event tracking

Attached Image

Getting Started with Event Tracking

Before we get into the structure of event data, let’s talk about analysis. All analysis starts with a business question. What is the most popular organic keyword that visitors searched for? How many sales did I have last week? What was the revenue for a specific campaign? Normally, when you’re using Google Analytics, you don’t need to do any special configuration to answer these questions. Google Analytics does most of it for you.

But with events, you need to create all of the data that will end up in Google Analytics. You literally need to define what data you want Google Analytics to collect both in name and in value. If you don’t know what business questions you want to answer, you won’t be able to collect the correct data.

As we continue this section, we’ll use Google Maps (shown in Figure 10-18) as our example. If I was an analyst for Google Maps, I would want to answer a lot of questions:

  • How many people use the zoom and do they zoom in or out?

  • Which map view is most popular: map, satellite, hybrid, etc.

  • How many people drag a map waypoint to a new location?

To make things easy, let’s focus on one business question: which map view is the most popular? So, now that we know the question we want to answer, let’s talk about the data we need to answer it.

Figure 10-18. Event tracking is the perfect way to track page level objects, like the map in Google Maps

Attached Image

Understanding the data model

There are four parts to the events data model: categories, actions, labels, and values.

Categories are buckets that group the actions visitors perform on our web pages. This may be a video player or an Ajax widget. Using our Google Maps example, the category would be “Map.” Remember, the business question we want to answer concerns a feature in the map part of the page.

You can alter the category to meet your reporting needs. Consider that Google Maps appears in multiple languages. If we need to report on the performance of each language version, we may create different values for the categories, specifically one for each language:

  • Map – US English

  • Map – UK English

  • Map – FR French

The second part of the data model is actions. Actions represent the literal actions that visitors perform on our web pages and are grouped by categories. Actions literally tell us what the visitor did.

Lots of actions can occur on a web page. Just think about our map—here are a few actions that our map might have:

  • Zoom

  • Change view type

  • Drag waypoint

  • View traffic

  • Print

  • Send email

  • Get a link to the map

Because we’re focused on one business question, we’re going to focus on one action: change view.

Warning: Google Analytics will report on all actions independently of the categories they’re associated with. This provides another way to slice the data and investigate how visitors are interacting with your content. However, there is a drawback to this functionality. If you have two actions with the same name that belong to different categories, Google Analytics will sum their data when you’re viewing by action. Be careful when naming your actions. Try to use a unique name so the Actions report will make sense.

Labels describe the action that occurred. If the actions tell us what the visitor did, the value tells us the result. The label value is optional. For the ‘Change view type’ action listed in the types of actions above, we might have the following labels:

  • Satellite

  • Satellite with Labels

  • Map

  • Terrain

Labels are really important to understanding actions. If an action only has one value, it does not provide any insight into what the visitor did.

The final part of the data model is values. Values are optional, but can provide a lot of insight into certain events. Values can be any integer that indicates the value of the action/label combination. The values usually relate back to some type of measurement or a monetary value.

There are no good measurement values associated with our Google Maps data, so let’s assign a monetary value to each action/label. Who knows, maybe someone viewing a hybrid map is worth more than someone viewing a regular map due to the ads Google displays:

  • Satellite = 10

  • Satellite with Labels = 15

  • Map = 5

  • Terrain = 0

Values have no units associated with them, so if some action/label combination has units of dollars and a different action/label combination has units of miles, Google Analytics will sum them indiscriminately. It’s best to stick to one set of units.

Google Analytics

Learn more about this topic from Google Analytics.

Take advantage of Google Analytics' powerful and free tools to understand exactly how users behave when they visit your website or use your web application. This hands-on guide shows you how to probe general traffic, marketing, and ecommerce information with these tools, and teaches you how to supplement them with add-ons and external tools when you want to dig even deeper. You'll also learn how to create custom reports to analyze specific issues.

See what you'll learn

0 Replies