How Experiments Execute
Knowing what the A vs B snippet does, step by step, helps you build better experiments and debug problems faster. This section walks through the full lifecycle, from the snippet tag loading to an event reaching A vs B's servers.
Overview
Every page load runs the same fixed sequence:
- The first install tag hides the page before the browser paints it, so visitors never see a flash of the original content.
- The loader tag fetches the snippet bundle.
- The bundle fetches your project's datafile (the file listing everything active in your project: experiments, metrics, and more).
- The snippet reads the visitor's cookie, or creates one for a first-time visitor.
- It checks each experiment's targeting rules (the conditions that decide who is eligible) and audiences (named, reusable groups of visitors).
- It injects the code for whichever variation (one specific version being tested, control or one of the challengers) each visitor should see.
- It sets up tracking for the metrics on running experiments.
- It reveals the page.
Each stage is covered in detail across the pages below.
Pages in this section
Execution OrderThe complete step-by-step sequence of events from page load to results tracking.
Project JavaScriptWhat Project JS is, when it runs, and how to use it for global setup and QA overrides.
Targeting & AudiencesHow the snippet filters experiments by page URL, audience, and how much of your traffic enters each test.
TriggersHow to control exactly when and how a variation is activated using the trigger API.
Variation CodeWhen CSS and JS are injected, what context they run in, and how to write effective variation code.
Anti-FlickerHow the page is hidden before the first paint, when the safety timeout fires, and how to change it.
SPA NavigationWhat happens when a visitor moves between pages without a full reload: cleanup, re-evaluation, and keeping each visitor in the same variation.
Event TrackingHow exposures and conversion events are queued, batched, and sent to A vs B servers.