Tracking Custom Functionality via Custom Variables in Google Analytics

One of the biggest slights that I have heard recently about Google Analytics vs. a paid service (Omniture SiteCatalyst, Coremetrics, WebTrends), is that it can’t track custom variable and can only handle out of the box tracking through its ga.js file.  However, this isn’t correct.Within Google Analytics, you are allotted 5 custom variables for which you can allocate any user behavior occurring on the site.  Below is an example of how the variable is called within Google Analytics:pageTracker._setCustomVar(2, “Basketball”, “NBA D-League”, 2);Above, the first value, 2, signifies the variable that this will fall into.  You can select 1-5 in this area.  The “Basketball” is the top level name for the content category in this case Basketball. The 3rd value, “NBA D-League”, is the value that we want to assign to the Basketball category. The last value is the scope for the variable.  There are three potential values that can go in here: 1 for visitor level, 2 for session level and 3 for page level.Now with the above variable, which needs to be placed above the trackPageview() function (as shown below):<script type=”text/javascript”>var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);document.write(unescape(“%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));</script><script type=”text/javascript”>var pageTracker = _gat._getTracker(“UA-0000000-1″);pageTracker._setCustomVar(2, “Basketball”, “NBA D-League”, 2);pageTracker._trackPageview();</script>Now track a host of things but remember that you only have 5 variables available for customization so choose wisely.



Written by:

Google, Google Analytics, Web Analytics

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

3 Responses to “Tracking Custom Functionality via Custom Variables in Google Analytics”

Leave Comment

(required)

(required)