Check variation

Check which variation of an experiment is assigned to a user.

const experimentId = 'experiment-1';
tesfy.getVariationId(experimentId); // '1'

A userId and attributes could be optionally supplied.

const userId = '676380e0-7793-44d6-9189-eb5868e17a86';
const attributes = { countryCode: 'us' };
const experimentId = 'experiment-1';
tesfy.getVariationId(experimentId, userId, attributes); // '1'

Set forced variation

Set a variation for a given experiment. This could be really helpful for testing purposes.

const experimentId = 'experiment-1';
const variationId = '2';
tesfy.setForcedVariation(experimentId, variationId);
tesfy.getVariationId(experimentId); // '2'