Developer Reference
This section is for developers who want to go beyond the basics.
What is available
A vs B ships a set of developer tools. You will not need all of them for every experiment. Knowing what each one does helps you pick the right one for the job.
- Snippet SDK (
window.avsb): the public JavaScript API the snippet puts on every page where it runs. Use it to track custom events and tag visitors into segments. You can also force a variation (one version being tested) for QA, wait for elements to appear, and send data to other analytics tools. - CLI tool + Chrome extension: a command-line tool and a browser extension that work together. Clone an experiment to your computer and edit its code in your own editor, with TypeScript and SCSS. Save a change and watch it appear live in Chrome, then push the finished code back to the platform.
- Public REST API: manage experiments, metrics, and results over HTTP, authenticated with a service token or your own personal access token.
- Personal access tokens: long-lived tokens tied to your account. They sign you in to the CLI tool and the REST API. Create and revoke them from your account settings.
- Credentials: A vs B uses four kinds of credential: personal access token, service token, SDK key, and snippet key. Credentials explains what each one looks like, where you find it, and which two are safe to share publicly.
In this section
Snippet SDK APIComplete reference for the window.avsb object and all its methods.
Tracking EventsDeep dive on avsb.track.event(): when to call it, how batching works, and revenue tracking.
Custom SegmentsTag visitors with attributes using avsb.track.segment() for filtered results.
Force VariationUse avsb.forceVariation() to QA-test specific variations before launch.
Wait UntilWait for DOM elements, JavaScript globals, or custom conditions with the promise-based avsb.waitUntil() before running variation code.
Utilities (avsb.utils)Full toolkit of wait, timing, DOM, event, data, and logging helpers available in every variation and trigger.
Event bus (avsb.on)Subscribe to every experiment event in real time to integrate with any other tool.
CredentialsAll four A vs B credentials in one table: personal access tokens, service tokens, SDK keys, and snippet keys, and which of them are public.
Personal Access TokensCreate and manage tokens for CLI authentication and API access.
Public REST APIAuthenticate with a service token or your own personal access token, and manage experiments, metrics, and results over HTTP.
Local DevelopmentThe full workflow: clone, edit in your IDE, preview live, push to platform.
Chrome ExtensionThe browser extension that injects your locally-edited variation code into Chrome so you can preview changes live as you save.
CLI ToolThe avsb command-line tool: install it, log in with a token, clone experiments, and push variation code back to the platform.