Adapters let Vanity
Have one out there? Open a PR to update these docs!
Building an Adapter
An adapter should inherit from AbstractAdapter . It should wrap an underlying connection to a datastore and implement an API that Vanity can use to store/access metrics and experiments.
A good place to start when creating your own adapter is to copy one of the adapters mentioned above and replace the client specific code with whatever client you are attempting to adapt.
The API for an adapter is divided into four categories: connections, metrics methods, experiment configuration methods and experiment data methods.
- metric_track(metric, timestamp, identity, values)
- metric_values(metric, from, to)
Experiment configuration methods
- set_experiment_created_at(experiment, time)
- set_experiment_enabled(experiment, enabled)
Experiment data methods
These ab_* methods interact with the underlying data of an experiment.
- ab_counts(experiment, alternative)
- ab_show(experiment, identity, alternative)
- ab_showing(experiment, identity)
- ab_not_showing(experiment, identity)
- ab_add_participant(experiment, alternative, identity)
- ab_seen(experiment, identity, assignment)
- ab_assigned(experiment, identity)
- ab_add_conversion(experiment, alternative, identity, count, implicit)
- ab_set_outcome(experiment, alternative)