* You are viewing the archive for the ‘web development’ Category

Google Analytics - Event Tracking

Recently Google Analytics has added support for Event Tracking.  This allows you to track users actions that involve  javascript, AJAX, and flash.  Before it was really hard to track if someone was using components on a page that didn’t actually get page hits.  The code is very simple to use and here is an example of how to use it:

pageTracker._trackEvent('Menu', 'Click', 'Clicked More Link');

The first parameter is your category, the second being the action, and the third being your label.  The above example could be a “More” link in your menu that when clicked uses javascript to show more links.  You can can essentially use this for any actions a user does on a page involving javascript.

How does this work in flash?  You can use flash’s ExternalInterface.Call(); function and pass it a string of javascript code (like above) which will track an event from within flash.  You can simply replace each parameter with a variable based what action the user is doing.

Using the the Track Event function from Google Analytics will help keep all of these actions in one spot.  We previously were tracking these actions by made up pages and having to access the Content area to see them all.  It was a little harder to track since it gets mixed in with all the other pages.  Looking forward to seeing what else we can use this for!