Developer Reference
This section covers everything developers need to go beyond the basics. You will find a complete reference for the JavaScript SDK that the snippet exposes on your pages, documentation for the command-line tool that lets you build and test experiment code locally, the Chrome extension that powers the local development workflow, and a guide to personal access tokens for CLI authentication and API access.
What is available
A vs B ships four developer-facing tools. You do not need all of them for every experiment, but knowing what each one does will help you choose the right tool for each task.
- Snippet SDK (
window.avsb) — The public JavaScript API exposed by the snippet on every page where it runs. Use it to track custom events, assign visitor segments, force variations for QA, wait for dynamic elements to appear, and integrate with third-party analytics tools. - CLI tool + Chrome extension — A command-line interface and browser extension that let you clone an experiment to your local machine, edit variation code in your own IDE with TypeScript and SCSS, see live changes in Chrome as you save, and push finished code back to the platform.
- Personal access tokens — Long-lived tokens tied to your account that authenticate the CLI tool. You can create and revoke tokens from your account settings.
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.
onEvent CallbackReceive experiment events in real time to integrate with custom analytics systems.
Personal Access TokensCreate and manage tokens for CLI authentication and API access.
Local DevelopmentCLI tool, Chrome extension, and the full workflow: clone, edit in your IDE, preview live, push to platform.
Quick start for developers
If you just want to get the local dev workflow running as fast as possible:
- Create a personal access token.
- Follow the Local Development guide — it covers CLI installation, extension setup, and the full end-to-end workflow.