Event tracking tutorial
18th June, 2010 - Posted by gabe.francis - 3 Comments
Analytics collects a lot of data default, but all that data is based entirely on users taking actions _between_ pages (clicking links, submitting forms, and general page navigation, etc). But what if we want to track data about actions the users take _within_ our pages? That’s where Event Tracking comes into play.
AJAX load events, video plays, or even mouse-overs of buttons can all be captured, measured, and reported using Google’s simple Event Tracking method. All it takes is a simple line of code added to your dynamic page elements to send rich sets of data to Analytics for later analysis.
In this article we’ll describe when to use Event Tracking vs fake Pageviews, take you through a few examples of Event Tracking, and then provide useful links that describe how to implement this powerful tool.
When to use Event Tracking vs fake Pageviews
We’ve already told you that Event Tracking is best at tracking Events _within_ pages, but those of us familiar with the old days of Google Analytics know there is an alternate way to measure such “events”. Fake pageviews means calling Google’s _trackPageview method a second time within the HTML – example pageTracker._trackPageview(“/fakepageview/”). This “/fakepageview/” gets listed in your Top Content report as if it were a real page on your website. This is a useful method of tracking in page events that is still used across many Analytics installations. However, there are a few problems with this approach. For one, sending fake pageviews skews some key metrics. Naturally the pageview and pages per visit numbers will increase, but your Bounce Rate could also be artificially low and Depth of visit artificially high. All this confusion may lead you to falsely believe users are much more engaged than they actually are. Also, if you run a large website more pageviews brings you closer to the range in which Google Analytics will start sampling your reports. That can lead to a lot of frustration later. Best to avoid it by using an alternate method that is just as easy to implement and more versatile. Alternatively, fake Pageviews are a better choice if you want to count that user event within the page as a Goal. It’s important to note that, at time of writing, Events cannot be counted a goals in Analytics.
So when should we use Event Tracking? Simple. Any time you want to monitor a user action on the page that does not need to be counted a goal. Consider Events as a method of measuring user intent. Events can be cross-segmented with all your other data using Advanced Segments to give you rich insights into user behavior.
Clever Uses of Event Tracking
Here are a few broad categories where Event Tracking is especially useful:
1. Video Plays
Have a flash or html5 video on your page? Consider measuring the number of plays that video gets with Event Tracking. For every time the user presses play, send an Event. To take it one step further start sending events at specific intervals of the video so you can count how many users actually watch the entire video.
2. Mouse-overs
When a user’s mouse cursor moves of a page element its usually an indication that their attention is focused on that item. If you’d like to determine how visually appealing certain elements are on your webpage considering sending an Event on mouseover. Later, you can comb through your data to figure out how appealing that new design is. To take it one step further, export the data to excel along with your goal data and determine the ratio of mouse-over events to button clicks. You can then start testing new designs to see how that delta changes.
3. AJAX elements
Once the buzz-word du jour AJAX is an effective method of loading new data without loading a new page. It’s a great user experience that Google Analytics, which is based on a linear pageview model, cannot measure by default. Event Tracking is a great way to measure those asynchronous loads. Want to count the number of times a user clicks on a tab, sorts a column, or makes that shiny widget twirl? Consider sending an Event. Later we can go back to determine which asynchronously loaded content is most attractive and most interacted with by our users.
Where to learn more about Event Tracking
Google’s own code site is by far the best place to start learning about how to implement the ideas above but here are some additional resource we find useful:
- Google’s official Event Tracker Guide
- Blog Post, Event Tracking Best Practices
- Analytics Talk fantastic Event Tracking Tutorial
- Videos on Event Tracking
- Google’s official video introducing Event Tracking
How are you using Event Tracking? Are we forgetting any links? Let us know in the comments below.
Posted on: June 18, 2010
Filed under: Chapter 5: Installing and Administering Google Analytics
3 Comments
Keith Wilkinson
July 7th, 2010 at 12:41 pm
I’m interested in tracking clicks on outgoing links. On p.336 of the Performance Marketing GA book, it notes that “when adding Javascript to a link, It’s best to create a custom Javascript function .. to ensure that the GA code executes before the browser redirects ..”
An example of this approach is shown at http://www.google.com/support/analytics/bin/answer.py?hl=en-uk&answer=55527 .
Is it still desirable to add a delay when using the new asynchronous GA code? If so, are there any recommendations for the form that such a delay function should take when using the new asynchronous GA code?
Keith Wilkinson
July 8th, 2010 at 12:44 am
I asked (whether a delay is still required) in the GA Help Forum, and the answer was “No”.
caleb.whitmore
July 16th, 2010 at 2:27 pm
Keith,
Delay or no, the bigger issue is hard-coding a tracking call for outbound links vs. automating it. IMO, you should never hard-code tracking calls into HTML – it’s like hard-coding Styles into an HTML element. Why do that when you can use a style sheet and separate formatting control from code?
There are many options out there to do just this, some with delay handlers built in, some without. The top three are:
1) APe – Analytics Pros Engine, a complete event tracking and universal tag management solution (my company built this). NOT free, but really cheap.
2) Brian Clifton, author of Advanced Web Metrics with Google Analytics has a script on his blog for automating outbound link tracking.
3) Google Analytics Certified Partner Actual Metrics has a script called LinkTagger for outbound link and cross-domain linking automation on their Analytics Market site.
You can also build your own code, use jQuery, or other JS libraries. Hope this helps!
Best,
-Caleb
Leave a reply