sigma-client
Node / Browser library for sigma AB testing framework.
Installation
Include the "sigma.js" script. The sigma
object will be added to your environment. In the browser do the following:
If you're using sigma-client with node.js start by installing it:
$ npm install sigma-client
then require the "sigma-client" module:
var sigma = ;
Usage
Check out the examples in the examples
directory for some quick examples for how to use the library. Here's a very basic example in node:
var sigma = ; var session = environment: city: 'bj' fr: 'bd_sem' server: 'web00' ; var data = experiment: 'test-exp' variants: 'alt-one' 'alt-two' force: 'alt-one' traffic: scope: city: 'bj' ;session;
When instantiating the session object you can pass optional params client
, baseUrl
, ipAddress
, userAgent
var sigma = client: 12345 baseUrl: 'http://www.renrenche.com/api/sigma' ipAddress: '1.2.2.1' userAgent: 'ChromeBot';
Client ID is a previously generated client id that you've previously stored. IP Address and User Agent are used for bot detection.
Forcing an variant
For debugging / design work it can be useful to force a page to load
using a specific variant. To force an variant use the force
parameter to participate()
. If you're using sigma.js in the
browser you can also just include a query parameter,
e.g. /your-page?sigma-force-EXPERIMENT_NAME=ALTERNATIVE_NAME
.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Write and run tests with
npm test
(requires mocha) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request