How Experiments Execute
Understanding what happens under the hood when the A vs B snippet loads will help you build better experiments, debug issues faster, and avoid common pitfalls. This section covers the full execution lifecycle — from the moment the snippet tag is parsed by the browser to the moment events are sent to A vs B servers.
Overview
When a visitor loads a page on your website, the following happens in sequence: the snippet loads and hides the page, it fetches your experiment configuration, it reads or creates the visitor's cookie, it evaluates each experiment against targeting rules and audience conditions, it injects variation code, it reveals the page, and it begins tracking events. Each of these stages is covered in detail in this section.
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 force bucketing.
Targeting & AudiencesHow the snippet filters experiments by URL, audience conditions, and traffic allocation.
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-Flicker BehaviorHow the page hiding mechanism works and when the safety timeout triggers.
SPA NavigationWhat happens during client-side route changes — cleanup, re-evaluation, and sticky bucketing.
Event TrackingHow exposures and conversion events are queued, batched, and sent to A vs B servers.