zach.holmquist.me

Hi. I am Zach.

I am a Salt Lake City Web Developer. This site serves as a collection of scraps from around the Internet that I find interesting.

Emphasis in Web Development,  , and things that are curious and interesting.

♫ now playing

Loading Artist.

Loading Track.
live. auto-refresh.
22 December 2009

Web Development Hidden Gem: Google Analytics Event Tracking

Google Analytics is a powerful tool in a Web Developers toolbox, but there are some incredible features that I don't think get enough coverage. One of them being, Event Tracking.

Event Tracking can really help open up some hidden information about what your users are doing. All it takes is having Google Analytics installed on the page and tying a click event to a the Analytics pageTracker._trackEvent function and passing three pieces of data: category, action, label.

pageTracker._trackEvent(category, action, label);

Category is the broadest description of the event, I usually go with the page where the event is taking place : "Landing Page", "Purchase Page", "Product Page", etc. Action is self explanatory, things such as: "Buy Button Clicked", "Apply Now Button - Top", "Apply Now Button - Bottom", etc. Finally, Label is optional, if I am tracking different buttons, I like to use different feature : "Blue Button", "Green Button". I have also passed in the domain the event took place on.

As far as using Event Tracking goes - the possibilities are endless! I like to use it heavily in web apps that don't click through and you cannot see the hits in Analytics. Some examples I have used are: Does this button or that button get more clicks, which fields throw validation errors most often, did user click a download button, did user play the video/did they pause the video, how often is the remove button clicked in a cart.

CODE

ACCESSING THE EVENT TRACKING DATA

view larger