Creates a new instance of the Bunchbox SDK.
During development it is recommended to reduce the log level to debug
.
(string)
the Bunchbox API token
(Object?)
Name | Description |
---|---|
opts.strict Boolean
(default true )
|
flag that controls how strict errors are handled |
opts.timeout Number
(default 5000 )
|
timeout value (in milliseconds) |
opts.logger Object?
|
all logging- related options |
opts.logger.colors Boolean
(default true )
|
controls the color output |
opts.logger.level string
(default 'info' )
|
the supported levels are:
- :trace - for very detailed debug-related messages - :debug - for debug-related messages - :info - for information of any kind - :warn - for warnings - :error - for errors |
undefined
:
const bb = new BunchboxSdk('$yourToken')
Buckets visitor into a variant and sends participation event.
If the referenced experiment has multiple steps an optional step index can be given to skip the evaluation of the step targeting.
Note: A given clientId
will always be assigned to same variant of an
experiment.
(Object)
Name | Description |
---|---|
args.clientId string
|
the user id |
args.experimentId string
|
the experiment id |
args.stepIndex number
(default null )
|
the step index |
(Object?
= {}
)
the (targeting) parameters
Promise<(string | false
)>
:
variation id
const bb = new BunchboxSdk('$yourToken')
const variantId = await bb.activate({
clientId: '43026325619819',
experimentId: '5b475fb051ceab0190f68719'
})
Sends a conversion event.
For convenience neither the experimentId
nor the goalIdentifier
must be
present. If both arguments are omitted effectively all
experiments with all their goals are tracked. Passing in one or even both
parameter(s) limits the events being tracked accordingly.
For example, passing in only an experimentId
leads to all goals of the
respective experiment being tracked. On the other hand, passing in just a
goalIdentifier
limits the result set to all experiments that have a goal
matching that identifier.
(Object)
Name | Description |
---|---|
args.clientId string
|
the user id |
args.goalIdentifier string
(default null )
|
the goal identifier |
(Object?
= {}
)
the (targeting) parameters
Promise<Boolean>
:
the result
const bb = new BunchboxSdk('$yourToken')
await bb.track({ experimentId: '5b475fb051ceab0190f68719' })
Triggers a reload of the testing file.
undefined
:
const bb = new BunchboxSdk('$yourToken')
bb.reloadTestingFile()
JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)
number
:
32-bit positive integer hash