Tuesday, March 31, 2009

Can Google Analytics and Google Website Optimizer play nicely together? (Part I)

Over the past couple of years, I've run both Google Analytics (GA) and Google Website Optimizer (GWO) on the same site. The problem is that out of the box, if you add a GWO experiment to a set of pages, GA will stop reporting correctly about those pages. (The situation that I run into is that I add a GWO experiment to one of my Goals -- say a lead gen funnel -- and then the GWO stats are correct. But GA stops reporting on my goal funnel. Quite an annoying situation.) Given that I'm fundamentally lazy (in a bad way) I haven't really tried to sort this out (until now).

First things first -- does Google realize that there's a problem, and do they think it can be solved? Turn out the answer is "Yes" and "Yes".

How to fix it. Google gives instructions here. Those instructions look like they're a bit outdated, as they include a call to secondTracker._initData() -- and GA / GWO doesn't seem to use that function call anymore.

But, it looks like the change is pretty straightforward -- all your GA code is going to be using:

var pageTracker = _gat._getTracker("UA-xxxx-xx");
pageTracker._trackPageview();

While all the GWO code is going to be using:

var secondTracker = _gat._getTracker("UA-yyyy-yy");
secondTracker._trackPageview("/zzzzzzz/test");
-- or --
secondTracker._trackPageview("/zzzzzzz/goal");

So, I've made the changes -- I'll have to check in tomorrow to see if they actually worked!

Update 6/20/09: By the way, this solution works perfectly.

No comments: