abtest
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 () {},
setCookie: function () {},
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;
});
License
MIT