1.0.6 • Published 7 years ago

laboratory v1.0.6

Weekly downloads
37
License
-
Repository
github
Last release
7 years ago

Build Status Dependencies devDependencies NPM version

Laboratory

Simple A/B Testing Framework for both client and server environments.

Laboratory chooses a variant for each experiment based on a configurable probability. Use the pluggable storage interface to serve users a consistent experience after they've been assigned a variant.

$ npm install laboratory

Example Usage

Run a single Experiment:

{Experiment} = require "laboratory"

experiment = new Experiment("color")
  .variant "red", 50, "#FF0000"
  .variant "blue", 50, "#0000FF"

variant = experiment.run()
variant.name # Either red or blue
variant.value # Either FF0000 or 0000FF

Run a suite of experiments in a Laboratory:

{Laboratory} = require "laboratory"
laboratory = new Laboratory()

laboratory.addExperiment("color")
  .variant "red", 50, "#FF0000"
  .variant "blue", 50, "#0000FF"

laboratory.addExperiment("FuzzyBunnies")
  .variant "variant0", 50,
    name: "Peter Rabbit"
    type: "Wooly"
  .variant "variant1", 50,
    subject: "Briar Rabbit"
    type: "Silky"

experiment = laboratory.run("FuzzyBunnies")
experiment.value # Either Peter or Briar Rabbit

Store the results per user in browser local storage:

store = new LocalStorageStore() # not included
laboratory = new Laboratory(store)

laboratory.addExperiment /* ... */
laboratory.run /* ... */
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago