A/B Testing Patterns
Ship experiments fast with Meridian's built-in variant routing and statistical analysis pipeline.
Overview
Meridian exposes a lightweight experimentation layer that assigns users to variants deterministically via a hash of their session ID. No sticky cookies, no client-side flicker — the variant is resolved at the edge before the first byte hits the browser.
Variant Assignment
Define experiments in meridian.config.ts with a name, traffic split, and target routes. Meridian hashes the incoming session and maps it to a bucket. Buckets are stable across deploys unless you change the experiment key.
Serving Variants
Use the useExperiment hook inside any server component. It returns the assigned variant and a boolean flag indicating whether the user is in the experiment at all. Branch your UI declaratively — no feature flag sprawl.
Metrics
Call trackConversion with the experiment name and a goal key. Meridian streams events to your analytics backend and computes Bayesian credible intervals so you know when a winner is statistically clear.
Ramp & Rollback
Start at 5% traffic and dial up in the dashboard. If the variant regresses, set traffic to zero — Meridian instantly serves the control to all users. No rollback deploy required.
Ready to run your first experiment? Read the getting started guide to wire up your project.