Provides a sane model for dealing with A/B tests.
Using npm:
npm install vgno-ably --save
Using bower:
bower install vgno-ably --save
var Ably = require('vgno-ably');
var ably = new Ably();
ably.addTest({
name: 'button-color',
sampler: ably.samplers.default({
red: 80,
green: 20
}),
scope: 'device'
});
The code above will create a test named button-color
, sample 80% of people to the red
variant and 20% to the green
one and persist information about the experiment on the device - so that the user will get always the same variant on this device.
ably
.on('button-color', 'red', function () {
$('#buy-button').css('background-color', 'red');
})
.on('button-color', 'green', function () {
$('#buy-button').css('background-color', 'green');
});
Subscribe to all variants of a test:
ably
.on('button-color', function (test) {
$('#buy-button').css('background-color', test.getAssignment());
});
Ably contains a collection of experiments.
An experiment has:
- a name
- a sampler which assigns users to variants
- a scope which persists information about the experiment
Read more about all supported options in the Documentation.
BrowserStack has gracefully agreed to provide us with a sponsored plan. We will soon start relying on their infrastructure to run automated browser tests.