Vanity is an Experiment Driven Development framework for Rails.
- All about Vanity: http://vanity.labnotes.org
- On github: http://github.com/assaf/vanity
http://farm3.static.flickr.com/2540/4099665871_497f274f68_o.jpg
A/B Testing With Rails (In 5 Easy Steps)
Step 1: Start using Vanity in your Rails application:
Rails::Initializer.run do |config|
gem.config "vanity"
config.after_initialize do
require "vanity"
end
end
And:
class ApplicationController < ActionController::Base
use_vanity :current_user
end
Step 2: Define your first A/B test. This experiment goes in the file experiments/price_options.rb:
ab_test "Price options" do
description "Mirror, mirror on the wall, who's the better price of all?"
alternatives 19, 25, 29
metrics :signups
end
Step 3: Present the different options to your users:
Get started for only $<%= ab_test :price_options %> a month!
Step 4: Measure conversion:
class SignupController < ApplicationController
def signup
@account = Account.new(params[:account])
if @account.save
track! :signups
redirect_to @acccount
else
render action: :offer
end
end
end
Step 5: Check the report:
vanity report --output vanity.html
Contributing
- Fork the project
- Please use a topic branch to make your changes, it's easier to test them that way
- Fix, patch, enhance, document, improve, sprinkle pixie dust
- At minimum run rake test, if possible, please run rake test:all
- Tests. Please. Run rake test, of if you can, rake test:all
- Send a pull request on GitHub
Credits/License
Original code, copyright of Assaf Arkin, released under the MIT license.
Documentation available under the Creative Commons Attribution license.
For full list of credits and licenses: http://vanity.labnotes.org/credits.html.