Experiments · every plan
Experiments: Bayesian results for your feature flags
Give a flag a percentage split, start an experiment, and send the events you care about with OpenFeature's track. Railflag shows the chance each variation beats control, by how much, and whether the split itself is healthy. This page explains exactly how the numbers are made.
An experiment in Railflag analyses a flag's existing percentage split in one environment. Starting one changes nothing about who gets which variation: it tells the SDKs to report which variation each user got, and counts the events you choose for each user from that moment on.
How it works
- Split the flag. Give the flag a percentage split on its Targeting tab, for example 50/50. Users are bucketed by their key, the same way as any rollout.
- Start the experiment from the flag's Experiments tab: pick the control variation and up to ten metrics. The first metric is the primary one and decides the result.
- The SDKs report exposures. When your code checks a flag that is in a running experiment and the user got their variation from the split, the SDK reports that user and variation once. Users in individual targets or rules that serve a fixed variation are not part of the experiment.
- Your code sends events with OpenFeature's
track, with the same user key. Only events a running experiment counts are sent. - Railflag computes the results every minute while the experiment runs, and keeps the final readout when you stop it.
Sending events
Each metric counts one event name in one of three ways: users who did it (a conversion rate), times per user, or value per user, which adds up the value you send, for example order totals. Mark a metric "lower is better" for errors or refunds.
// Node, with @railflag/sdk-node 0.4 or later
client.track('purchase', { targetingKey: user.id }, { value: order.total });
// Browser, with @railflag/sdk-js 0.3 or later (uses the context you set)
OpenFeature.getClient().track('signup');
# Python, railflag-openfeature 0.4 or later
client.track("purchase", EvaluationContext(user.id), TrackingEventDetails(value=order.total))
// Go 0.3 and Java 0.2 or later
client.Track(ctx, "purchase", openfeature.NewEvaluationContext(user.ID, nil), openfeature.NewTrackingEventDetails(order.Total))
client.track("purchase", new ImmutableContext(user.getId()), new MutableTrackingEventDetails(order.getTotal()));
Events count from each user's first exposure to the end of the experiment. An event a user sent before they saw the flag never counts. If you already track events in an analytics tool, you can keep doing that: Railflag only needs the events you want it to analyse.
| SDK | Version with experiments | Turn off |
|---|---|---|
Node.js (@railflag/sdk-node) | 0.4.0 | sendEvents: false |
Browser (@railflag/sdk-js) | 0.3.0 | sendEvents: false |
Python (railflag-openfeature) | 0.4.0 | send_events=False |
Go (railflag.com/go/openfeature) | 0.3.0 | DisableEvents: true |
Java and Kotlin (com.railflag:railflag-openfeature) | 0.2.0 | sendEvents(false) |
All five SDKs are tested against the same shared vectors, so they report exactly the same exposures and events for the same calls.
Reading the results
For each metric and each variation, Railflag shows four numbers:
- Lift: how much higher or lower the variation is than control, relative to control. +8% on a 10% conversion rate means 10.8%.
- 95% interval: the range the true lift is in with 95% probability, given the data and the prior. The narrower it is, the more you know.
- Chance to win: the probability that the variation is better than control. For a "lower is better" metric, better means lower.
- Status: better, worse, not clear yet, or still collecting.
Under the hood, Railflag estimates the relative lift and its standard error from each variation's users, totals and squared totals (the delta method), then combines that with a Normal prior on the lift by precision weighting. Every number comes straight from the resulting Normal distribution, with no simulation, so the same data always gives the same result. This is the same model GrowthBook, Eppo, Statsig and PostHog use, and the formulas follow GrowthBook's open source gbstats.
The prior, shown on every result
By default Railflag uses a Normal(0, 30%) prior on the lift: most changes move a metric by less than 30% either way. With plenty of data the prior hardly matters. When the lift's standard error is 5%, it pulls the estimate toward zero by 2.7%. With little data it protects you from wild early numbers: at a standard error of 20%, typical of a small site's first week, it pulls the estimate 31% of the way toward zero. You can pick a flat prior instead, which uses the data alone. Results always say which prior they used.
When a variation wins
- Enough data first. No statistics are shown until every variation has 100 users, and 25 conversions for a "users who did it" metric.
- 97.5% after the minimum runtime. A variation is better at a 97.5% chance to win, and worse at 2.5%, once the experiment has run its minimum number of days: 7 by default, so every weekday is in the data. With a flat prior, 97.5% is the same bar as a two-sided test at the usual 5% level.
- 99.9% before it. Before the minimum runtime only a very strong result counts.
- The primary metric decides. If several variations beat control, the one with the biggest lift is suggested. Check the other metrics before rolling out the winner.
Health checks that hide bad results
A wrong number is worse than no number, so data problems hide the statistics instead of footnoting them.
- Sample ratio mismatch. Railflag compares the users per variation with the split's weights using a chi-square test. At p < 0.001, with at least 8 users per variation, the results are hidden. Bucketing is deterministic, so a mismatch almost always means exposures are being lost for one variation: an old SDK, a code path that checks the flag differently, or bots.
- Users in more than one variation are left out of the analysis, and the page warns when they are more than 1% of users. This usually means the split changed during the experiment.
- Split changes. Changing a split's weights moves users between variations. The page warns when the split differs from the one the experiment started with; start a new experiment to analyse the new split.
- Extreme values. Count and value metrics are capped at the 99.9th percentile of all users together, so one very large order can't decide the result.
A word on checking results early
Bayesian results are sometimes sold as safe to check at any time. They are not quite. If you look every day and stop the first time a variation crosses the line, you will declare more false winners than the 97.5% suggests. Railflag reduces this with the prior, the minimum runtime and the 99.9% bar before it, but it can't remove it. The reliable habit is simple: decide how long the experiment runs before you start, and decide when it ends. Railflag does not offer sequential testing yet.
Privacy and data
- User keys are hashed before they are stored. The relay replaces each key with an HMAC-SHA256 hash under a secret key and per environment. Railflag never stores the key itself.
- Only what an experiment needs is sent. SDKs send user keys only for flags in a running experiment, and only events an experiment counts. With no experiment running, nothing user-specific leaves your process. Every SDK has an option to turn it off.
- Raw events are kept 90 days. The final readout of a stopped experiment is kept until you delete the experiment. All data is stored in the EU.
- Limits. An environment can send up to 120,000 exposures and events a minute; above that, batches are dropped.
Frequently asked questions
Which plans include experiments?
Every plan, including the free Starter plan. Experiments don't change how Railflag meters usage: server-side flag checks stay unmetered.
Does Railflag store my users' IDs?
No. SDKs send the user key only for flags in a running experiment and only for events an experiment counts. The relay replaces it with a keyed hash (HMAC-SHA256) before anything is stored, and all data stays in the EU.
Why Bayesian and not a p-value?
Chance to win and a credible interval answer the question people ask: how likely is it that B is better, and by how much. Railflag labels the prior it uses, Normal(0, 30%) on the lift by default, so the numbers can be checked.
Can I check results every day?
Yes, but stopping the first day a variation crosses the line still raises the chance of a false winner. Railflag requires 99.9% before the minimum runtime (7 days by default) and 97.5% after it. Decide the runtime up front and stop then.
Can an experiment cover only one rule of a flag?
An experiment covers every user the flag puts in a variation through a percentage split. To test on one audience only, use a flag whose only split is in that audience's rule.
Measure the next thing you ship
Experiments are included on every plan, with the same SDKs you use for flags.
Start for free