Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

goodeggs/laboratory

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple A/B Testing Framework for client and server

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CoffeeScript 100.0%