Provides a sane model for dealing with A/B tests

Usage no npm install needed!

<script type="module">
  import vgnoAbly from '';



Build StatusTest CoverageCode Climate

Provides a sane model for dealing with A/B tests.


Using npm:

npm install vgno-ably --save

Using bower:

bower install vgno-ably --save


Defining tests

var Ably = require('vgno-ably');

var ably = new Ably();

    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.

Subscribing to variants

    .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:

    .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

API Reference

Read more about all supported options in the Documentation.

Browser tests

BrowserStack has gracefully agreed to provide us with a sponsored plan. We will soon start relying on their infrastructure to run automated browser tests.

BrowserStack logo