views:

1450

answers:

4

Some information on A/B split-testing:

I could do this in a Rails app with a simple case or if statement in my views, but that gets to be a lot of repetition. Is there a gem to support this? Any design patterns that would help?

+2  A: 

In ApplicationController:

options = ["option1", "option2", "option3"]
session[:option] ||= option.rand

In your views render a partial based on the one you want and the option chosen:

<%= render :partial => "foo#{session[:option]} %>

That way you guarantee that the user gets the same option for the entire session, across the whole site. Plus you can go back to the default partial by just setting the option to an empty string. You could even put an empty string in the array, or duplicate entries to change the weighting of how often each one is chosen.

You can use Google Website Optimizer to figure out which option did the best conversion. Check out their step-by-step walkthrough in their documentation, Quick Start Guide - Website Optmizer Help. That has the bits of JavaScript you'll need to add.

Otto
This is a great way to render the different views, but how do I run them through analytics to see which ones are the most successful? Google Analytics, e.g., is URL-based; partials won't change for different URLs. Just append query params?
James A. Rosen
Sorry, I thought you were assuming Google Website Analyzer since you linked to the 37signals article that talked about how they did it and you just wanted help on the technical bits of getting it to happen. Hope that helps.
Otto
Oh, I see. Google Analytics has a "Website Optimizer." It still means setting up unique URLs for A and B, but it does the conversion tracking for you. Well, it's a start.
James A. Rosen
I don't think you need to set up a unique URL. It looks to me you just need to have a different javascript tag on each version.
Otto
Otto can you explain in more detail on how to do that? From what I see on GWO, you have to specify different URL for variation pages.
Khairul
+2  A: 

Have you seen 7 Minute ABs, an A/B testing plugin for rails?

http://github.com/paulmars/seven_minute_abs/tree/master

kareem
brilliant. perfect. exactly what I was looking for.
James A. Rosen
+7  A: 

I just released A/Bingo, an OSS Rails plugin to do this.

You can see the comparison with Seven Minute Abs for details, but I think it is largely more easy to use.

  • It supports tracking any event as a conversion. Seven Minute Abs only tracks clicks off the page you're currently viewing.
  • It remembers what alternative a user saw, and only shows them that.
  • It has lots of syntax sugar aimed at maximizing programmer productivity.
  • It will do statistical significance tests for you.
Patrick McKenzie
+2  A: 

Vanity is worth a mention. Some GA integration, custom metrics, clean code. Github here.

jdwyah