Giter Club home page Giter Club logo

vanity's Introduction

Vanity is an Experiment Driven Development framework for Rails.

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:

<h2>Get started for only $<%= ab_test :price_options %> a month!</h2>

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

Building From Source

To run the test suite for the first time:

$ rake test:setup test

Vanity is tested against multiple Ruby implementations. To run the full test suite against all Ruby implementations and bundled adapters:

$ rake test:rubies
$ # only ruby 1.9.2
$ rake test:rubies[1.9.2]
$ # only redis
$ rake test:adapters[redis]

To build the documentation:

$ rake docs
$ open html/index.html

To clean up after yourself:

$ rake clobber

To package Vanity as a gem and install on your machine:

$ rake install

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: vanity.labnotes.org/credits.html.

vanity's People

Contributors

assaf avatar jsboulanger avatar tswicegood avatar

Watchers

Aria Stewart avatar pete gamache avatar  avatar ken mazaika avatar Kevin C. Kupillas avatar James Cloos avatar TJ Miller avatar  avatar Sergey Andreev avatar Ante Sabo avatar David Brochu avatar Janet Zhou avatar  avatar Komiya Anthony avatar  avatar Alex Tironati avatar Ricardo Schaefli avatar Sokkalingam, Subramanian avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.