pivot
pivot is a simple feature multi-variant and A/B testing framework for node and component.
It is designed to have a pluggable backend and provide a common interface to each testing strategy.
Installing
node
npm install --save pivot
component
component install CamShaft/pivot
Lookup Strategies
TODO
Assignment Strategies
TODO
Guide
Start by initializing pivot
/** * Module dependencies */var pivot = ; var experiments = ;
You'll need to tell it about the following methods:
lookup
This method looks up the variant settings in the backend. It is called any time pivot encounters a new feature.
experiments;
assign
This method takes the settings from the last call and assigns them to a user.
experiments;
If you plan on using it paired with express/connect, you can also define the following.
Otherwise, pivot will serialize/deserialize using the pivot
cookie and req.user
.
serialize
experiments;
deserialize
experiments;
findUser
experiments;
feature
Once you have told pivot how to do things you can start adding features into the system:
// Variants, be default, are [false, true]experiments; // You can also add multi-variantexperiments;
variant
Now you can ask pivot to assign a variant to a user:
var user = {}; // pull from your user info experiments
variant
is either true
or false
depending on how we implemented the assign
method.
handle
If you are using express/connect pivot comes with some batteries included:
/** * Module dependencies */var express = pivot = ; /** * Create our server and experiments */var app = moduleexports = experiments = ; /** * Add our experiment setup to express */app; /** * Configure pivot here with the required methods */... experiments; app;
res.locals.features
is now populated with all of the enabled features for the
user.
Testing
npm installnpm test