Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A javascript a/b test library
JavaScript
tag: 0.0.4

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
dist
integration
lib
test
.gitignore
Makefile
README.md
build.json
package.json

README.md

Dice Roll

A simple a/b test library for javascript

Features

  • Pass in any percentage to test
  • Will cookie user so they stay in the test when they come back (requires: cookie-monster)
  • Get a callback that tells you whether the user is in the test or not

Installation

download dice-roll.js from dist directory. (If you want the test to be persistance across visits, download cookie-monster as well)

Usage

diceRoll('testName', expiration)
    .test(percentage, callback);
    .test(percentage2, callback2);
    .otherwise(callback3);
    .run();

Example

diceRoll('testName', 1) //cookied for 1 day
    .test(10, function() {
        //10% of the time user will be in this test
    });
    .test(20, function() {
        //20% of the time user will be in this test 
    });
    .otherwise(function() {
        //called if not in either other test (70% of the time)
    });
    .run();
Something went wrong with that request. Please try again.