Provides an API for bucketing users in experiments.
Methods
getBucket(experiment, token) → {string|undefined
}static
#
undefined
}static
#
Gets the bucket for the experiment given the token.
The name of the experiment and the token are hashed. The hash is converted to a number which is then used to get a bucket.
Example
// The experiment has three buckets: control, A, and B. The user has a 50% chance of
// being assigned to the control bucket, and a 25% chance of being assigned to either
// the A or B bucket. If the experiment were disabled, then the user would always be
// assigned to the control bucket.
{
name: 'My first experiment',
enabled: true,
buckets: {
control: 0.5
A: 0.25,
B: 0.25
}
}
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
experiment |
Object |
Properties:
|
||||||||||||
token |
string | A token that uniquely identifies the user for the duration of the experiment |
- Source:
Returns:
The bucket
- Type
-
string
|
undefined
Gets the bucket for the experiment given the token.