1.0.0 • Published 8 years ago

split-test v1.0.0

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

split-test

A support library to simplify split testing. We have a repository of working examples you can reference in https://github.com/mobify/adaptivejs-split-test-examples

Quickstart

Install split-test using npm:

$ npm install split-test --save-dev

Defining a split condition

var splitTest = SplitTest.init(
    {
        'A': 0.4,
        'B': 0.5,
        'C': 0.1
    },
    {
        namespace: 'foo'
    }
);

Obtaining the split value

splitTest.getChoice();

Methods

init

Adds a script to a custom container.

Parameter nameTypeDescription
valueObjectThe split condition
optionsObjectThe setup parameters
var splitTest = SplitTest.init(
    {
        'A': 0.4,
        'B': 0.5,
        'C': 0.1
    },
    {
        namespace: 'foo',
        cookieDomain: 'http://www.foo.com',
        lifetime: 15
    }
);

Available options

OptionsTypeDescription
namespaceStringThe namespace of the cookie to prevent conflict between cookie names
cookieDomainStringThe domain of this cookie. Default to the hostname
lifetimeInteger (milliseconds)The lifetime of the cookie. Default to 30 days.

getChoice

Returns the split choice key.

// This returns either 'A', 'B', or 'C'
var choice = splitTest.getChoice();

setChoice

Manually sets the split choice.

Parameter nameTypeDescription
valueStringsplit choice key
splitTest.setChoice('C');

// This return 'C'
splitTest.getChoice();

How to create and ship a change

  • Make your code changes and create a pull-request
  • Ensure the tests still work (grunt test)
  • Get your change reviewed and :+1:'ed

Changelog

  • 1.0.0: Remove bower dependencies and dist folder, distribute on npm
  • 0.0.1: Initial commit

Where to get help

Talk to @jansepar or @dbader.

1.0.0

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago