JJ Games

Integrate Google Analytics & Website Optimizer - Works On Most Recent Analytics Code

This article isn't about video games like most of my other articles. It's for website owners and developers.

Google Website Optimizer is great for testing website changes to see how they change a conversion rate but it doesn't let you see how a change might effect average order value, total revenue, or other metrics that might be more important in deciding which page variation is the best.

By integrating Website Optimizer and Google Analytics you see exactly how each page variation performs based on more metrics and make a better decision.

This method modifies ones created by Eric Vasilik at Website Optimizer Tricks and Shawn Purtell at ROI Revolution so it will work with the newest Google Analytics code.

Code to Place Optimizer Data Into Analytics

The below code will need to be placed on your website. This code works with the newest asynchronous analytics tracking:

<script type="text/javascript">
try {
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_setVar', 'MyExperiment-' + utmx('combination')]);
} catch(err) {}</script>

The code needs to be placed after the asynchronous snippet & after the Google Optimizer Control Script. The html will look something like this:

A bunch of <head> stuff
A bunch of <head> stuff

<!-- Google Analytics Asynchronous Snippet -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);

(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);

<!-- End Snippet -->

<!-- Google Website Optimizer Control Script -->
function utmx_section(){}function utmx(){}
(function(){var k='XXXXXXXXXX',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return c.substring(i+n.
length+1,j<0?c.length:j)}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
<!-- End Control Script -->



<!-- GA & GO Integration Script -->
<script type="text/javascript">
try {
_gaq.push(['_setAccount', 'UA-XXXXXX-X']);
_gaq.push(['_setVar', 'MyExperiment-' + utmx('combination')]);
} catch(err) {}</script>
<!-- End Integration Script -->

A bunch of content
A bunch of content
A bunch of content

The stuff you are testing

<!-- Google Website Optimizer Tracking Script -->
<script type="text/javascript">
if(typeof(_gat)!='object')document.write('<sc'+'ript src="http'+
<script type="text/javascript">
try {
var gwoTracker=_gat._getTracker("UA-XXXXXX-XX");
<!-- End Tracking Script -->


What The Code Does and Running Reports

The code shown above will make a User Defined variable in Google Analytics (GA) named after the Optimizer combination the user saw.

Google Optimizer reports look like this:
Google Optimizer Report
Click for Larger Image

You can see a comparison of the conversion rate for each combination and a confidence interval showing how likely it is that the difference between the combinations is statistically significant.

Running a report in Google Analytics can compare the different combinations with a lot more metrics like bounce rate, total revenue, and per visit value.

To see the report in GA go to the "Visitor" link on the left, then "User Defined". As shown in the image below:
User Defined Variable Analytics

Search by "myexperiment" to remove any other User Defined variables you might have used previously and you will see a report like this:
Integrate Analytics and Optimizer Report
Click for Larger Image

Each combination will have an individual listing and you can compare total revenue, average sale, and per visit value to see which combination actually improves overall revenue instead of just conversion rates.

WARNING: The data in GA reports does not show confidence intervals like Website Optimizer reports do. You will need to run some statistical analysis on your own to make sure the differences are statistically significant.

Pages that use the Google Website Optimizer integration will not have the benefits that asynchronous tracking usually has because GWO is not optimized for asynchronous tracking yet. The pages will all work fine, but they might load a bit slower than without the integration. (Thanks to Trevor Claiborne on the Google Optimizer team for pointing this out)

Digg del.icio.us Stumbleupon Reddit

No comments:


Copyright JJGames.com Privacy Policy | 7975 E Harvard Ave | Suite G | Denver, CO 80231

Web design by Hendricks Solutions