@tgam/amelia
v0.3.0
Published
The Globe and Mail's A/B testing software
Keywords
Readme
amelia
Named after aviator and explorer Amelia Earhart, amelia is The Globe and Mail's a/b testing software. It will consistently bucket users into a/b test groups by combining a unique identifier (salt), experiment name and the total audience allocated to the experiment into a key.
Each experiment must define the following properties:
namesaltpercentageallocations
An experiment may also define optional attributes which is an object of arbitrary keys/values that can be referenced in React/Vue components that run experiment code.
Amelia exposes a single method named init. This method expects an object that defines a datafile of experiments and a user object that has an id property. The user id is used as part of the experiment bucketing process. If the user id or the experiment salt changes then users will be re-bucketed.
Upon initialization amelia will return an object that defines experiments and user properties. The experiments property will be an array of experiment objects.
The following example code demonstrates how to define experiments and initalize amelia:
import amelia from "@tgam/amelia";
const experiment1 = {
name: "Test 1",
salt: "A unique string",
percentage: 100,
allocations: [
{ id: "control", percentage: 50 },
{ id: "variant", percentage: 50 }
]
};
const experiment2 = {
name: "CEM-5422",
salt: "v1",
percentage: 85,
allocations: [
{ id: "control", percentage: 25 },
{ id: "variant1", percentage: 50 },
{ id: "variant2", percentage: 25 }
],
attributes: {
foods: ["pizza", "ice cream", "cucumbers"],
colour: "blue",
description: {
short: "Lorem ipsum",
long: "Lorem Ipsum is simply dummy text of the printing and typesetting industry"
}
}
};
const user = { id: "5ee24e0b-97d8-a477" };
const datafile = {
experiments: [experiment1, experiment2]
};
const { experiments } = amelia({ datafile, user });