Rovenue SDKBeta
Guides

Experiments

How Rovenue decides an A/B test's winner — the stopping rule, its four gates, and what it does and does not guarantee.

Rovenue's experiments are Bayesian: every result is a posterior distribution over a metric (conversion rate, ARPU, or proceeds per user), not a p-value. A single decision-engine endpoint backs both the dashboard results page and the SDK-facing placement resolution, so there is exactly one number for any given experiment at any given time — never a dashboard figure that disagrees with what the SDK actually served.

This page documents the decision rule itself, the assumptions it depends on, and — as importantly — the places it is honest about what it cannot tell you.

The stopping rule

A variant is only ever recommended for shipping when all four of the following hold. Any one of them failing withholds the recommendation entirely; the response tells you which gate is blocking (SAMPLE_SIZE, RUNTIME, SRM, CROSSOVER, REFUND_GUARDRAIL, EXPECTED_LOSS, NO_LEADER). Proceeds metrics always resolve a rate — configured, or the store's default — so there is no gate for a missing rate.

  1. Expected loss — the leader's expected loss, expressed as a fraction of the control's posterior mean, is below a fixed relative threshold (0.2%). Expressing it as a fraction rather than an absolute amount is what lets the same threshold mean the same thing for a conversion rate and for ARPU.
  2. Sample size — every arm has reached the sample size required to detect the experiment's own configured minimum detectable effect.
  3. Whole weekly cycles — at least one full week has elapsed since the experiment started, regardless of how quickly clause 2 was satisfied. A high-traffic app can clear any sample threshold inside a single weekday, and shipping on one weekday's user mix is the classic novelty / day-of-week trap. This gate exists specifically to prevent that.
  4. No integrity or guardrail failure — none of three checks has fired: a sample-ratio mismatch (the observed traffic split disagrees with the declared weights), excessive crossover contamination (subscribers exposed to more than one variant), or the refund guardrail (the leader's refund rate is meaningfully worse than control's). Unlike the other gates, these three suppress the leader outright rather than annotating it — a recommendation rendered next to a warning is a recommendation that gets shipped anyway, so leadingVariantId is withheld entirely rather than shown alongside a caveat.

What "expected loss" does and does not guarantee. Expected loss bounds the expected regret of shipping the leader, computed under the posterior model's own prior. It is not a Type-I error rate, and clearing this gate is not the same claim as "p < 0.05." Rovenue also does not claim that continuously monitoring this number is "safe" in the frequentist sense — that guarantee belongs to a different statistical framework and this engine does not make it. The fixed-horizon Welch's-t cross-check the results page also shows is the closest thing to a frequentist read available here, and it is only valid at the experiment's originally planned sample size — never during continuous monitoring, and never as the decision itself.

The value model, and what it assumes

For revenue-based metrics (ARPU, proceeds per user), Rovenue fits a log-normal posterior to each variant's per-converter value: the conversion rate and the per-converter value are modeled and drawn independently, then multiplied per Monte Carlo draw — never by multiplying their posterior means, which is not the same thing for correlated quantities drawn from one experiment.

The value factor is fitted per subscriber, not per order. A subscriber who purchases twice in one experiment contributes one net-revenue figure, not two independent data points — treating repeat purchases from the same person as independent observations overstates the sample and understates uncertainty.

The log-normal assumption has a real, visible failure mode: if every mature converter in a variant paid the exact same price (a paywall selling one product at one price is the common case), the log-value variance is exactly zero. Rovenue treats that as information, not as missing data — the posterior mean is exact in that case, and the metric's remaining uncertainty lives entirely in the conversion rate, where it belongs. The Welch's-t cross-check makes no distributional assumption at all, which is why the results page shows both and flags it when they disagree in sign.

The maturation window

Every subscriber's revenue is counted for a fixed number of days starting at their first exposure to the experiment — the maturation window. Revenue inside that window counts; revenue after it does not. It is a window, not a delay. Subscribers whose window has not yet fully elapsed are excluded from every revenue metric and from the conversion-rate denominator entirely; they are not counted as non-converters, because that would penalize a variant purely for having gained traffic recently.

This means exposures from the last several days are not counted yet. An experiment that looks flat because recent traffic hasn't matured is not necessarily flat — check the Excluded column on the variants table (immature / crossover, beside the Mature count every posterior is fitted on) before concluding a variant has no effect.

A subscriber is also excluded — separately, into a "crossover" bucket — if a single id of theirs was exposed to more than one variant of the same experiment (same-id crossover; merged customers are handled differently, see below). A crossover rate above a small threshold suppresses the recommendation entirely (gate 4 above), because a contaminated split cannot honestly attribute an outcome to either arm. The rate is shown on the analysis card beside the SRM verdict. It is a fraction of customers: each contaminated customer counts once, in the variant they saw first (results computed before this rule counted them once per variant they touched, so the same data now reads about half as high; the threshold did not change).

Two different things are called crossover, and only one of them stops an experiment:

  • Same-id crossover — one id was served more than one variant. That is a bucketing or serving defect, the customer is excluded, and the rate feeds the suppression gate above.
  • Merge crossover — a customer's ids were merged after each id saw a different variant, but no single id saw two. Nothing was mis-served, so the customer stays in the analysis, counted once, in the variant of their earliest exposure across all their ids. It is reported on the analysis card ("Merged customers exposed to more than one variant") and never suppresses the recommendation. Holdout merge crossover (a merge that splits a customer between the holdout and a variant) is counted separately from the variants' figure, and does not stop the experiment either.

Earliest exposure decides the variant: when two exposures share the exact same time, a real variant beats the holdout cohort, and between real variants the lexically smallest variant id wins, so the result is deterministic. The conversion window is measured from that earliest exposure.

A fully refunded purchase is not a conversion

A subscriber whose gross revenue is fully offset by refunds within the maturation window is not counted as a converter. This is a deliberate semantic change from what an earlier, now-removed results path reported: that older code counted any purchase event as a conversion regardless of what happened to it afterward. Net revenue (gross minus refunds) is what drives every conversion count, every log-value aggregate, and every revenue-per-user figure on this page — a purchase-then-full-refund is economically a non-event, and is now reported as one.

Partial refunds still count the subscriber as a converter, but reduce their contribution to net revenue accordingly.

A subscriber whose net is negative — refunded more than they generated, e.g. a chargeback against an accumulated balance — is not a converter either, by the same net > 0 rule. They still contribute their negative amount to the revenue-per-user cross-check, which is computed over all mature subscribers rather than over converters.

Holdout groups

A project can reserve a percentage of subscribers as a permanent holdout: membership excludes a subscriber from every experiment on every placement, serving them the control treatment instead — the experiment's first declared variant, the same arm the results page treats as control — with their exposure still recorded against a reserved holdout cohort id (an unmeasured holdout is just a smaller, wasted audience). A held-out subscriber is never shown an empty placement: they see the control funnel, just never a treatment. Their exposures are reported separately from the experiment's arms, so switching a holdout on never changes an experiment's own split, SRM verdict or recommendation. Membership is decided server-side, before the client ever receives an experiment's variant menu — the variant draw itself is client-side and deterministic, so holdout has to be resolved earlier than that, not layered on top of it.

Raising and lowering the holdout percentage are not symmetric. Membership is "hash below a threshold," so raising the percentage only ever adds subscribers and leaves every existing member in place — the accumulated comparison stays valid. Lowering it removes members whose exposures are already recorded, retroactively mixing previously-held-out and now-treated data in the same cohort. Raising is safe to do at any time; lowering is lossy and should be treated as starting a new comparison, not adjusting an old one.

Variants are materialized server-side

A FUNNEL experiment's variants each name a whole funnel. The server materializes them into complete per-variant snapshots before they are ever sent anywhere, so what reaches the device is a menu of fully resolved funnels to draw from — never a reference the client has to go fetch.

Materialization is all-or-nothing. If any declared variant's funnel is archived, inactive, or unpublished at resolution time, the whole variant set is dropped rather than served short: the variant draw is client-side and falls through to the last variant for any bucket past the cumulative weight total, so a partial set would silently route 100% of traffic to one arm while every exposure still logged as a normal split.

A cached envelope or offline fallback file generated before an experiment existed on a placement predates it entirely — it has no idea the experiment exists, because it was resolved and frozen before the experiment was created. The device only sees the experiment once it reaches the network again and re-resolves the placement live.

The offline fallback file freezes the menu, not the decision

The dashboard's bundled fallback-file export (Dashboard → SDK → Offline fallback, served by GET /dashboard/projects/:projectId/placements/fallback-export) resolves every active placement anonymously — no subscriber id, no attributes — and is bundled into the app before it ships. Because it is generated before any subscriber exists to draw a variant for, what it captures for an experiment-targeted placement is the undrawn menu as of export time: the same shape a live anonymous request would return, with no variant singled out yet. So the bundled file is an undrawn menu, not a decision — it freezes whatever the placement resolved to at export time, before any per-subscriber draw has happened.

The actual variant draw only happens on-device, deterministically, once a real subscriber id is available to hash against the experiment's key — the same mechanism whether the SDK is reading a live response, a cached one, or the bundled fallback. That includes an experiment whose variants are funnels: it rides in the envelope on its own key, but it is drawn by the same function against the same bucketing vectors, so a given subscriber lands on the same variant offline as online. A stale export (taken before an experiment started, or before an audience rule changed) means an offline device keeps resolving whatever the placement pointed to when the file was generated until it can reach the network and re-resolve live — for an experiment-targeted placement, that is most often its pre-experiment or default path.

Re-export the fallback file whenever you start, stop, or retarget an experiment on a placement you also ship offline coverage for.

Web funnel A/B tests

A web funnel experiment splits the visitors of one web funnel address between whole funnels. It is an ordinary FUNNEL experiment that names a control funnel (webControlFunnelId), and it runs at the control's address — there is no new URL to hand out. While it runs, every address that serves the control serves the experiment:

  • https://<your-dashboard-domain>/f/<projectId>/<slug>;
  • https://<your-domain>/<slug> on the project's custom domain;
  • https://<your-domain>/, when the control is the domain's root funnel.

Ad links, QR codes and the domain root you already published start testing without anyone editing them. A variant's own slug keeps working, but it runs that funnel outside the experiment: nothing is stamped and nothing is counted (and while the experiment is live, its page head is noindex, see Hosting).

Web funnel experiments are off by default. The deployment's WEB_FUNNEL_EXPERIMENTS_ENABLED flag must be true. While it is off, the API answers 409 FEATURE_DISABLED (error.details.feature = web_funnel_experiments) to creating an experiment with webControlFunnelId, and to starting, split-editing, resuming or duplicating one; stopping one is always allowed. Session start assigns no arm, so every address serves its own funnel. Self-hosters: turn it on only once every API node runs a release that has it — see the release notes.

Create and start

Create it with POST /dashboard/experiments:

POST /dashboard/experiments
{
  "projectId": "<project id>",
  "name": "Pricing page: annual first",
  "type": "FUNNEL",
  "webControlFunnelId": "<control funnel id>",
  "variants": [
    { "id": "control", "name": "Control", "weight": 0.5, "value": { "funnelId": "<control funnel id>" } },
    { "id": "annual-first", "name": "Annual first", "weight": 0.5, "value": { "funnelId": "<variant funnel id>" } }
  ],
  "primaryMetric": "CONVERSION"
}

The rules (webFunnelExperimentCreateSchema in packages/shared/src/experiments/types.ts, and the API's arm checks):

  • variants[0] is the control and must serve webControlFunnelId.
  • 2 to 4 arms (WEB_EXPERIMENT_MAX_VARIANTS: the control plus up to three variants), each a different funnel. Weights sum to 1, and no arm may have weight 0. The variant id legacy is reserved.
  • No audienceId: a web experiment uses the project's Everyone audience.
  • Every arm is a published web funnel of the project, otherwise 400 WEB_EXPERIMENT_ARM_INVALID (error.details.reason: not_web, not_published or archived).
  • A funnel serves at most one live (RUNNING or PAUSED) web experiment, as control or as variant: 409 WEB_EXPERIMENT_ARM_IN_USE. Two concurrent starts that share a funnel resolve to one success and this refusal.
  • Arms may sell different offerings and currencies — price tests are the main use. POST /dashboard/experiments/:id/start refuses with 409 WEB_EXPERIMENT_VARIANT_NOT_PAYABLE when the control can take payment and a variant cannot.

While the experiment is live, archiving, deleting or converting an arm, and renaming any arm's slug, answer 409 FUNNEL_IN_LIVE_EXPERIMENT (error.details.experiment names it): the control's slug is the address, and a winner swap relies on the variants' slugs. Republishing an arm is allowed.

How a visitor gets an arm

The runner keeps a random visitor id (a cuid2 — never derived from the IP, the user agent or a fingerprint) under rovenue.funnel-visitor. At session start (POST /public/projects/:projectId/funnels/:slug/sessions) it sends that id, the assignment tokens it holds and the ?rv_variant override if any. The server decides the arm, in this order; the assignment_source it records says which rule won:

assignment_sourceRuleCounted in results
forced?rv_variant=<variantId> names an arm (see QA)no
legacyno visitor id: a runner from the previous release, which can only render the control. The session runs the control, stamped variant legacyno
stickya stored assignment token is valid: its signature verifies, its visitor id is this visitor's, the experiment is still RUNNING and its arm still existsyes
holdoutthe visitor falls in the project's holdout percentage: served the control, stamped with the holdout cohortyes, as the holdout row
hasheveryone else: selectVariant(assignBucket(visitorId, key), variants), the same deterministic bucketing as native experimentsyes

The session-start response carries experiment: { key, variant_id, token } (or null) and served: { funnel_id, slug, version_id }, the funnel the session actually runs. The runner stores the token under rovenue.funnel-exp:<projectId>:<experimentKey>; a later visit sends it back and keeps the arm, even after the split changes. Any other token is ignored and the visitor is drawn by hash, so two tabs opened at the same moment still land in the same arm. A paused experiment stamps nothing new.

The results unit is the visitor: each visitor counts once, in the arm of their earliest exposure within the revision.

Changing the split opens a new revision

A weight edit while RUNNING (PATCH /dashboard/experiments/:id with variants: [{ id, weight }], the same arms) opens a new allocation revision (allocationRevision, with the history in allocationHistory) and announces experiment.allocation_changed. Visitors who hold a token keep their arm; new visitors are drawn with the new weights. Arms cannot be added or removed while running.

The verdict is computed on the current revision only:

  • visitors, conversion, SRM and the sample-size gate count only visitors first exposed under the current revision, and SRM checks against that revision's own weights;
  • the one-week clause of the stopping rule counts from the revision's effectiveAt, so a split edit restarts the clock;
  • earlier revisions are returned as read-only history rows (visitors, converters, conversion and revenue per arm) with no verdict. They are never pooled: pooling would compare arms whose traffic mix changed over time.

Reading the results

GET /dashboard/experiments/:id/results?env=production|sandbox (default production) returns the same variant rows and decision as a native experiment, plus:

FieldMeaning
surfaceweb_funnel
attributionWindowDaysthe window fixed at start (below)
currentRevision{ revision, weights, effectiveAt } the verdict is computed on
historyone read-only row per earlier revision
diagnosticssessions left out: forced (QA), legacy, bots, and otherEnvironment

Each variant also carries checkoutCompletions (sessions that reached funnel.session.paid, trials included), trialStarts (paid sessions whose purchase started a free trial) and arppu (revenue ÷ converters, display only). GET /dashboard/experiments/:id/steps?env= gives the per-screen arrivals of each arm under the current revision. A project whose Stripe connection is in test mode records its sessions as sandbox, so read those with ?env=sandbox; arms are never mixed across environments. A Test checkout session joins the experiment and draws an arm like any visitor, so every variant's checkout can be tried, but it is a sandbox session: production results leave it out and count it under diagnostics.otherEnvironment.

A conversion is a visitor with a net-positive charge inside the attribution window, the same rule as native experiments: a $0 trial start is not a conversion, and a fully refunded purchase is not one either. Revenue per visitor (ARPU) and proceeds per visitor (PROCEEDS_PER_USER) are net USD, so arms priced in different currencies compare directly. Revenue reaches the visitor through the funnel session it was bought in — subscriptions and their renewals, one-time purchases and refunds alike.

The verdict, Conv. rate, Revenue and ARPPU count mature visitors only, so for the first week (the attribution window) of a test they read — and $0. Beside them the dashboard shows Conversions (live) — visitors with a charge since their first view — and Revenue (live) — gross inside each visitor's window — both including immature visitors, plus a note with how many visitors are still immature and the date the oldest of them matures. The live figures are display only; the API returns them as liveConversions, liveRevenueUsd and nextMaturesAt on each web variant.

The attribution window adapts to trials

A web experiment's window is fixed when it starts and stored as attributionWindowDays:

attributionWindowDays = max(7, longestTrialDays + 3)

7 is the maturation window above; longestTrialDays is the longest free trial among the arms' offerings at start; 3 (TRIAL_CHARGE_MARGIN_DAYS) leaves room for the first charge after the trial. Without trials the window stays 7 days. A 7-day trial gets 10 days, a 14-day trial 17.

The window bound is strict, so with a 7-day trial and a 7-day window the first real charge would land at or after the window's end and never count — a trial arm would always lose. The window does not change while the experiment runs: republishing an arm with a longer trial does not move it.

Stop with a winner: the winner takes the address

POST /dashboard/experiments/:id/stop with winnerVariantId. If the winner is the control, or there is no winner, nothing moves. Otherwise the stop, in the same transaction:

  1. renames the control's slug s to s-control-<n> (the smallest n that is free);
  2. releases the winner's old slug and gives the winner s;
  3. points every custom-domain root that served the control at the winner.

Neither funnel is archived, and funnel ids never change, so history keyed by funnel stays correct. Tokens held after the stop are ignored, and sessions already under way continue on the funnel they started.

Because the address changes, the request must say so: "confirmAddressChange": true. Without it the stop answers 400 WEB_EXPERIMENT_ADDRESS_CHANGE_UNCONFIRMED, with error.details.slug (the address) and error.details.funnelId (the funnel it would serve). The same confirmation is required in the request that turns on autoWinnerOnStop for a web experiment (create or a DRAFT edit), because the scheduler would then move the address on its own. The stop emits experiment.stopped with the winner, the funnel the address now serves and whether it was automatic — see Outbound Webhooks.

POST /dashboard/experiments/:id/stop
{ "winnerVariantId": "annual-first", "confirmAddressChange": true }

If the winner cannot take the address — its funnel was archived, it is no longer a web funnel of the project, or no s-control-<n> slug is free — the stop rolls back and answers 409 (FUNNEL_ARCHIVED, or WEB_EXPERIMENT_ARM_INVALID with error.details.reason); the experiment keeps running. A scheduled stop with autoWinnerOnStop does not retry such a winner: it stops the experiment with no winner, the control keeps the address, and the refusal is recorded as autoWinnerRefused on the stop's audit entry and its experiment.stopped webhook.

Holdout

The project's holdout percentage applies to web visitors too, decided on the visitor id. A held-out visitor sees the control and is recorded against the holdout cohort, which the results split out exactly as for a native experiment. A visitor who already holds a token keeps their arm when the percentage is raised later.

Bots get the same content a human with that visitor id would get — there is no cloaking, so an ad-review crawler sees what visitors see. At session start the API flags a session is_bot when its user agent matches the shared list (BOT_USER_AGENT_PATTERNS in packages/shared/src/funnel/bots.ts: search and ads crawlers, Meta and TikTok review agents, headless browsers, monitors, plain HTTP clients) or the runner reports navigator.webdriver === true. Flagged sessions are dropped from the results and counted under diagnostics.bots. Link-preview scrapers that do not run JavaScript never start a session at all. Every arm shares the control's page head (title, link preview) at the address.

QA a specific arm

Add ?rv_variant=<variantId> to the address to open that arm:

https://<your-domain>/<slug>?rv_variant=annual-first

It works while the experiment is DRAFT, PAUSED or RUNNING, so arms can be checked before launch. The session is recorded as forced, gets no token and never counts. The runner strips rv_variant before it reads app values and campaign parameters, so it is never stored as one.

Where the visitor id and tokens are kept — browser storage that persists, or only after consent — is a project setting, described with the consent signal on Hosting & Embedding. A subject's export lists the visitor id and experiment arms of their claimed and paid funnel sessions.

Erasure blanks that visitor id in Postgres and ClickHouse on every session that carried it, not only the paid or claimed one: an earlier unpaid visit by the same browser loses its visitor id too, so nothing links the subject to the experiment population any more. Those sessions keep their arm, revision and source and still count in the results (the visitor id is not a results input; the arm is). Erasure first waits until the subject's funnel events still in the outbox have reached ClickHouse, so a late event cannot bring the visitor id back.

On this page