• Follow us on Twitter
  • Join our Facebook Group
  • Join me on Google Plus
  • Add me on Linkedin
  • RSS

  • Home
  • Services
  • Tools & Downloads
    • Google Analytics Content Targeting Generator
    • A/B/n Split Test Confidence Calculator with Graphing
    • Simple Feedback Form with Google Analytics Integration
  • About
  • Contact

Blog - Latest News

See Google Website Optimizer (MVT) Tests in Google Analytics

4 Comments/ in Testing / by Robert Kingston
May 19, 2010

So, you’re about to run a test in Google Website Optimizer and you have to track something crazy like revenue per visitor, ecommerce tracking, multiple goal points and so on… If you’re just running plain old GWO, you can’t track that – Sucks I know, but…

Custom Variables and Google Analytics Save the Day

I initially got this code from Cameron over at Analytics Market (but I’ve since tweaked it to improve error handling and to keep data within GA accurate). It’s been a life-saver for whenever I’ve been tracking micro conversions (click throughs, vistor engagement etc) and wanted to peek a little deeper into visitor behaviour on the site, right through to the macro conversion (i.e. purchase, sign up, application, transaction values, lead conversion in CRM etc).

Anyway, by using Custom Variables you’re able to insert the variation number from GWO into GA, like so:

All you need to do is throw in code like this within your Google Analytics code:

try {
    if(utmx('combination') != undefined){
    try {pageTracker._setCustomVar(1, "Test-1", "Variation-" + utmx('combination'), 2);
    }
}catch(err){}

Otherwise, if you’re using the new asynchronous tracking, use this:

try {
   if(utmx('combination') != undefined){
   _gaq.push(['_setCustomVar', 1, 'Test-1', 'Variation-' + utmx('combination'), 1]);
   }
}catch(err){}

Your Google Analytics code then should resemble:

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-Y']);
try {
   if(utmx('combination') != undefined){
   _gaq.push(['_setCustomVar', 1, 'Test-1', 'Variation-' + utmx('combination'), 1]);
   }
}catch(err){}
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

Importantly, note how setCustomVar is placed before trackPageview but after setAccount? This order is important to ensure tracking.

Deciphering the code:

‘1‘ refers to the slot the variable sits in (GA currently allows you to use 5 slots – 1 through to 5)
‘"Test-1"‘ is the name of the variable – I suggest you use the name of your experiment here
‘"Variation-" + utmx('combination')‘ dynamically inserts the GWO variation number into GA
‘1‘ refers to the scope of the variable. I recommend using ’1′ if you’re only running a single experiment on the site, or ’3′ if you are running more than one experiment on the site.

I suggest reading more information on using custom variables over at Google’s documentation.

Analysing Test Data in Google Analytics

All you need to do now, is run some reports – I recommend setting up advanced segments as I have done in some examples above, or through creating custom reports.

To find out if the result is statistically valid or not, you should try my A/B/n split test significance calculator.

Track GWO A/B/n Experiments in GA

This also requires a different setup read another followup post of mine here on Tracking A/B Experiments in Google Analytics.

← The Real Reason To Make Data Driven Marketing Decisions?
Track RSS Subscribers’ & Twitter Traffic in Google Analytics →
Comments

4 Responses to See Google Website Optimizer (MVT) Tests in Google Analytics

  1. Jirka says:
    June 13, 2011 at 18:40

    Thank you for this cool solution, it is exactly what I was looking for!

    Just note: It is necessary to have GWO code at all pages – if not, it causes JavaScript error and GA tracking is not working.

    Reply
  2. Robert Kingston says:
    June 13, 2011 at 20:53

    Thanks Jirka… I haven’t updated this script in a long time, but I’ve just added a fix for it.

    Try that and it should work on all pages without the GWO code.

    Reply
  3. Jirka says:
    June 13, 2011 at 20:57

    Thanks, I already fixed it in the same way :-)
    According to my test it works flawlessly now.

    Reply
  4. Rob Kingston says:
    June 13, 2011 at 22:07

    Well done! Great minds think alike. :p

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

About Rob

I'm an ex-Hitwise Analyst turned freelancer that helps clients turn their analytics data into better converting websites. I also like to run, drink, eat and be merry. My girlfriend, on the other hand, would say I play too many computer games and use my Androids too much (yeah, right :P).

Subscribe For More Great Tips


Subscribe by RSS


Follow me on Twitter


Follow Optimisation Beacon on Google+

Categories

  • Analytics
  • Conversion Rate Optimisation
  • Marketing & Consumer Insight
  • News
  • Testing

Most Popular Posts

  • Google Analytics’ New Site Speed Report Tracks Page Load Times
  • Track WordPress Blog Comments in Google Analytics
  • Build a Conversion Rate Heatmap by Hour & Day of Week in Google Docs
  • Track Page Load Times with Google Analytics’ Asynchronous Script
  • See Google Website Optimizer (MVT) Tests in Google Analytics

Recent Posts

  • Web Browsers Most Susceptible to Browser Fingerprinting
  • Cohorts.js: Open Source JavaScript MVT Split Testing Framework
  • 10 Sources of Direct Traffic & How To Track Direct Shares
  • Track What Visitors Copy From Your Site in Google Analytics
  • Track How Far Your Users Scroll in Google Analytics

Blogroll

  • Analytics Ninja
  • Justin Koro
  • LunaMetrics Blog
  • Marketing Experiments
  • SnowPlow Analytics
  • Teacup Marketing
  • Visitor Centric CRO Community
  • Home
  • Services
  • Tools & Downloads
    • Google Analytics Content Targeting Generator
    • A/B/n Split Test Confidence Calculator with Graphing
    • Simple Feedback Form with Google Analytics Integration
  • About
  • Contact
415Follower294Subscribers
© Copyright - Optimisation Beacon - Wordpress Theme by Kriesi.at