Tuesday, November 01, 2011

Google Analytics Gotchas

  Having built quite a number of websites over my career, there is one feature that I always end up implementing right at the very beginning, ... Web Analytics.

  There is are several ways of going about it. Analysing apache logs, capturing session data are all low level ways of looking at the data. But when it comes to ease of use and powerful reports, nothing beats google analytics for the right combination of price (Free!) and features. With the gradual rollout of real-time analytics, it becomes even more powerful.

  Google Analytics is a wonderful free tool every website owner should use. Getting setup with google analytics is incredibly easy. The official google analytics site has very clear and succinct instructions:- http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

  This basic setup should give you reports about visits and pageviews and track your site's popularity over time. Other interesting metrics to look for is bounce rates, pages getting the most pageviews and how the users are landing on your site ( also known as referrals). That's a good place to start on how to optimize your site.

  You might find that having a distinct URL for each specific page on your site helps with tracking its usage seperately. This will be tricky to do if your main page is being reloaded with new content using Ajax. There are two ways to solve this - Virtual PageViews and Event Tracking.

Virtual Pageviews
  Virtual Pageviews are very simple. You force google analytics into thinking that a pageview has occured using a similar snippet of code :-
_gaq.push(['_trackPageview', '/module/specific_page']); 


This will be added as a pageview in your report.

Event Tracking
  Event tracking is a more versatile solution. The code tells google analytics that a particular event has occured. It is upto us to interpret and provide attributes of that event. Snippet of code :-

<a onclick="_gaq.push(['_trackEvent', 'category', 'action', 'opt_label', opt_value]);">click mea>

  The number of times each event occured and pages in which it occured can each be tallied in the report.

  Event tracking also allows us to capture more intricate details of a pageview. It is normally used to capture user interactions on the page that may or may not result in new content. Very useful when it comes to determine whether that button that you added, how often is it being used. Or is it just a distraction for the user.

Website Profiles and Filters


0 comments: