1.2.0 • Published 8 years ago

abtest v1.2.0

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

abtest

NPM version build status Test coverage David deps node version Gittip

an A/B test client for node web

Installation

$ npm install abtest

Feature

  • Random split user into different buckets.
  • Record user's bucket in cookie.
  • Force choose bucket by query.
  • Expire cookie when buckets changed.

Usage

use with koa:

var ABTest = ABTest();
var app = koa();

app.use(function* (next) {
  this.abtest = ABTest({
    getCookie: function () {},  // custom your getCookie method
    setCookie: function () {},  // custom your setCookie method
    query: this.query
  });
});

app.use(function* (next) {
  this.abtest.configure({
    bucket: {
      a: 9,
      b: 1
    },
    enableQuery: true,
    enableCookie: true
  });
});

app.use(function* (next) {
  this.body = this.abtest.bucket; // 10% a, 90% b
});

License

MIT

1.2.0

8 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago