Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fork of A/Bingo plugin for Rails.

tag: v0.1.0

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 tasks
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 abingo.gemspec
Octocat-spinner-32 init.rb
Octocat-spinner-32 install.rb
Octocat-spinner-32 strip.rb
Octocat-spinner-32 uninstall.rb
README
A/Bingo Version 1.0.0 - Rails 3 Version
=======================================

**This is a port of ABingo to work as a rails 3 plugin. It is not extensivly tested but appears to work. Future work will make it easier to use.**

**Known Issues with rails 3**

  * **Named Conversions do not work (eg :conversion => "signup")**



Rails A/B testing.  One minute to install.  One line to set up a new A/B test.
One line to track conversion.

For usage notes, see: http://www.bingocardcreator.com/abingo

Installation instructions are below usage examples.

Key default features:

  * Conversions only tracked once per individual.
  * Conversions only tracked if individual saw test.
  * Same individual ALWAYS sees same alternative for same test.
  * Syntax sugar.  Specify alternatives as a range, array, hash of alternative to weighting, or just let it default to true or false.
  * A simple z-test of statistical significance, with output so clear anyone in your organization
       can understand it.

Example: View
-------------

    <% ab_test("login_button", ["/images/button1.jpg", "/images/button2.jpg"]) do |button_file| %>
      <%= img_tag(button_file, :alt => "Login!") %>
    <% end %>

Example: Controller
-------------------

    def register_new_user
      #See what level of free points maximizes users' decision to buy replacement points.
      @starter_points = ab_test("new_user_free_points", [100, 200, 300])
    end

Example: Controller
-------------------

    def registration
      if (ab_test("send_welcome_email"), :conversion => "purchase")
        #send the email, track to see if it later increases conversion to full version
      end
    end

Example: Conversion tracking (in a controller!)
------------------------------------------------

    def buy_new_points
      #some business logic
      bingo!("buy_new_points")  #Either a conversion named with :conversion or a test name.
    end

Example: Conversion tracking (in a view)
-----------------------------------------

    Thanks for signing up, dude! <% bingo!("signup_page_redesign") >

Example: Statistical Significance Testing
------------------------------------------

    Abingo::Experiment.last.describe_result_in_words
    => "The best alternative you have is: [0], which had 130 conversions from 5000 participants (2.60%).
        The other alternative was [1], which had 1800 conversions from 100000 participants (1.80%).
        This difference is 99.9% likely to be statistically significant, which means you can be extremely
        confident that it is the result of your alternatives actually mattering, rather than being due to
        random chance.  However, this doesn't say anything about how much the first alternative is really
        likely to be better by."

Installation
==================

Configure the Gem
------------------

    gem 'abingo', :git => "git://github.com/wildfalcon/abingo.git", :branch => "rails3"

    bundle install 

Generate the database tables 
-----------------------------
Creates tables "experiments" and "alternatives". If you use these names already you will need to do some hacking)


    rails g abingo_migration
    rake db:migrate

Configure a Cache
-----------------
A/Bingo makes HEAVY use of the cache to reduce load on thedatabase and share potentially long-lived "temporary" data, such as what alternative a given visitor should be shown for a particular test.  

A/Bingo defaults to using the same cache store as Rails.  These instructions
are on how to use the memcache-addon in heroku.

    heroku addons:add memcache:5mb

    #Gemile
    group :production do
      gem "memcache-client"
      gem 'memcached-northscale', :require => 'memcached'
    end


    #config/environments/production.rb
    # Use a different cache store in production
    # config.cache_store = :mem_cache_store
    config.cache_store = :mem_cache_store, Memcached::Rails.new


Tell A/Bingo a user's identity
-------------------------------

So abingo knows who a users is if they come back to a test.  (The same identity will always see the same alternative for the same test.)  How you do this is up to you -- I suggest integrating with your login/account infrastructure.  The simplest thing that can possibly work

    #Somewhere in application.rb
    before_filter :set_abingo_identity

    def set_abingo_identity  
      #treat all bots as one user to prevent skewing results
      if request.user_agent =~ /\b(Baidu|Gigabot|Googlebot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)\b/i  
         Abingo.identity = "robot"  
       elsif current_user  
         Abingo.identity = current_user.id  
       else  
         session[:abingo_identity] ||= rand(10 ** 10)  
         Abingo.identity = session[:abingo_identity]  
       end  
    end

Create the Dashboard
--------------------

You need to create a controller which includes the methods from the Abingo module, as well as generate the views. You can customise the view if you wish.
Don't forget to authenticate access to the controller

    rails g controller admin/abingo_dashboard
    
    #app/controllers/admin/abingo_dashboard_controller.rb
    class Admin::AbingoDashboardController < ApplicationController
      include Abingo::Controller::Dashboard
    end
    
    #routes.rb
    namespace :admin do
      get "ab_dashboard"   => "abingo_dashboard#index"
      post "ab_end_experiment/:id"   => "abingo_dashboard#end_experiment"
    end
    
    rails g abingo_views
    
Run your first test
====================

Copyright (c) 2009-2010 Patrick McKenzie, released under the MIT license
Something went wrong with that request. Please try again.