Rails plugin integrating Google Web Optimizer for AB tests
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 2 commits ahead of maccman:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Rails plugin for Google Website Optimizer which easily allows AB testing.

This plugin allows dynamic content to be tested with GWO by rendering all
variations server-side and using an advanced technique to determine which
variation to show at browser parse time.

This elegant JavaScript hack was developed by Eric Vasilik (http://gwotricks.com/)
and has several nice features and advantages over other methods:

1. Avoids any client-side flickering (e.g. Like you might see using JavaScript or
   CSS to show/hide the variations).
2. The browser won't parse or render the variations that weren't selected 
   to be shown by GWO.  You can use something like FireBug to verify the 
   variation you are seeing is the only one shows up in the DOM.

3. Degrades gracefully if JavaScript is disabled or GWO errors out.  The control
   variation will be shown and the other variations are commented out.

The 'Usage' may look long - but it's fairly straightforward and shouldn't take 5 mins.

Tim Underwood - timunderwood@gmail.com (integrated Eric Vasilik's technique, created gwo_for helper and the Experiment class)
Alex MacCaw - alex@madebymany.co.uk (original plugin)


To use GWO, you need two pages:
* A test page containing the AB sections
* A page that signifies conversion (i.e. account creation page)

Signup for GWO and:
1.  Click create another experiment
2.  Click multivariate experiment
3.  Name it and enter the test/conversion urls
4.  Select 'You will install and validate the JavaScript tags'
5.   Ignore the scripts that are offered, but strip out your account id (uacct) and test id (in the Tracking Script).
     They look like this:
       _uacct = 'UA-6882082-1';
     So, in this example the uacct is 'UA-6882082-1' and the test id is 1662461989.
6.  Add the gwo_start tag after your opening <head> tag, passing your uacct.
7.  Create your gwo_sections, as in the example.
8.  Add the helper method gwo_end() before the closing </body> tag, passing the default section, uacct and test id as arguments.
9.  Deploy and validate the scripts in GWO
10. Enter sections for each of the named gwo_section helper tags, the content of the section should look like this:
11. Add a gwo_conversion helper tag on your conversion page passing in your test id and uacct.
12. Deploy and complete GWO wizard
13. Start recording stats & profit!

Example 1 (using the helpers directly)
    <%= gwo_start('1662461989') %>
<% gwo_section_control("test_section") do %>
  This is the control section.
<% end %>

<% gwo_section_variation("test_section", 1) do %>
  This is variation 1
<% end %>

<% gwo_section_variation("test_section", 2) do %>
  This is variation 2.
<% end %>

<%= gwo_end('1662461989', 'UA-6882082-1') %>

Example 2 (using the gwo_for helper to stay DRY)
<% @gwo = gwo_for(:experiment_id => '3902361761', :ga_acct => 'UA-7945208-1') %>
    <%= @gwo.start() %>
<% gwo.section('test_section') do |section| %>
    <% section.control() do %>
      This is the control section.
    <% end %>

    <% section.variation(1) do %>
      This is variation 1
    <% end %>

    <% section.variation(2) do %>
      This is variation 2.
    <% end %>
<% end %>

<%= @gwo.end() %>

Conversion page

  <%= gwo_conversion(1909920434, 'UA-23902382-1') %>

Copyright (c) 2009 Made by Many, released under the MIT license