laboratory

1.0.6 • Public • Published

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 /* ... */

Readme

Keywords

none

Package Sidebar

Install

npm i laboratory

Weekly Downloads

13

Version

1.0.6

License

none

Last publish

Collaborators

  • duereg
  • hurrymaplelad