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.

Tuesday, March 17, 2009

I need some Google Analytics Help!

A few weeks ago, one of the folks that I drive affiliate traffic for mentioned that another affiliate had seen improved revenue by running a 300x250 ad for their affiliate offer in place of an AdSense ad. I said I'd test it, and within a few days I was running a bright and shiny new clickable image. Now I must admit that I was lazy, and I ran the ad without really thinking through how I would tell which ad performed better. I was just hoping that the results would be so dramatic and obvious that I wouldn't be required to actually, you know, think. However, I did go so far as to add a JavaScript call (pageTracker._trackPageview('/affiliate/click1')) to the image that would record the click with Google Analytics each time someone clicked the image.

Now that I've dug around on the web a bit, I have a strategy for comparing the revenue generated by the two, and I'm looking for some feedback on this approach.

Basic Methodology

I'm going to write a cron job that switches the ads every 5 minutes. So, the AdSense ad will be displayed half the time, and the affiliate ad will be displayed half the time. (I could display the ads randomly on every pageview, but I can't think of any bias that this simpler approach introduces.)

Calculating AdSense Revenue

The AdSense ad is its own channel within AdSense, so I can slice and dice the data by channel and date.

Calculating Affiliate Revenue

This is a bit trickier. Basically, I'm setting up an "advanced segment" within Google Analytics for everyone that views the page '/affiliate/click1'. Then, if I segment "Goals -> Total Conversions" for the date range that I'm comparing to AdSense, I can get the total number of conversions. By multiplying the conversions by the revenue per conversion, I can get a dollar value for the affiliate ad.

If the two ads are alternated for a week, at the end of that week I should have a dollar amount for AdSense and a dollar amount for the Affiliate revenue. Whichever is higher, wins, no?

Potential problems


I'm assuming that by alternating the ads every 5 minutes, I will serve about as many of one ad as another. If it turns out that in fact, I've served 10x the number of affiliate ads as Adsense ads, then the results would be biased. Is there a straightforward way within GAnalytics to show the number of times an image is displayed? (An onLoad event for the image perhaps?)

One of the issues that comes to mind is that people may be more likely (or perhaps less likely!) to click on an ad if they see it multiple times. So it might be that the very act of alternating between AdSense and an image ad increases (or decreases) the number of conversions. So, I think ideally this would be further segmented: A group that sees only AdSense ads, a group that sees only Affiliate ads, and a group that sees both (if they request multiple pages from the site). But I can't think of a straightforward way to implement this (absent a cookie infrastructure that I'm not currently willing to invest in). Any thoughts?

This feels sort of kludgy -- is there a more elegant way to do this from within Google Analytics?