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
Install split-test
using npm:
$ npm install split-test --save-dev
var splitTest = SplitTest.init(
{
'A': 0.4,
'B': 0.5,
'C': 0.1
},
{
namespace: 'foo'
}
);
splitTest.getChoice();
Adds a script to a custom container.
Parameter name | Type | Description |
---|---|---|
value | Object | The split condition |
options | Object | The 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
Options | Type | Description |
---|---|---|
namespace | String | The namespace of the cookie to prevent conflict between cookie names |
cookieDomain | String | The domain of this cookie. Default to the hostname |
lifetime | Integer (milliseconds) | The lifetime of the cookie. Default to 30 days. |
Returns the split choice key.
// This returns either 'A', 'B', or 'C'
var choice = splitTest.getChoice();
Manually sets the split choice.
Parameter name | Type | Description |
---|---|---|
value | String | split choice key |
splitTest.setChoice('C');
// This return 'C'
splitTest.getChoice();
- Make your code changes and create a pull-request
- Ensure the tests still work (
grunt test
) - Get your change reviewed and ๐'ed
- 1.0.0: Remove bower dependencies and dist folder, distribute on npm
- 0.0.1: Initial commit
Talk to @jansepar or @dbader.