dice-roll

2.1.0 • Public • Published

Dice Roll

Build Status npm

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

npm install dice-roll

Usage

  diceRoll('testName', expiration) //jquery style chaining
    .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();

Readme

Keywords

Package Sidebar

Install

npm i dice-roll

Weekly Downloads

4

Version

2.1.0

License

MIT

Unpacked Size

11.2 kB

Total Files

6

Last publish

Collaborators

  • alaguna
  • aleperez92
  • dawnerd
  • ecwillis
  • jga
  • orthagonal1