Percentage Rollouts
How to use percentage rollouts with feature flags.
Percentage rollouts let you gradually enable a flag for a portion of your audience. Set a rollout percentage (1 – 100) on a flag, and users are deterministically bucketed so they see a consistent experience.
How It Works #
When a flag has a rollout percentage and no targeting rule has matched, the plugin computes a bucket (0 – 99) from a hash of the user’s identifier and the flag handle:
bucket = abs(crc32(userId + ':' + flagHandle)) % 100
If the bucket value is less than the rollout percentage, the flag is enabled for that user.
Important Info
- The same user always gets the same bucket for a given flag. No flip-flopping between visits.
- Going from 25% to 50% adds users. Nobody who had the feature loses it.
- The flag handle is part of the hash, so a user gets different buckets for different flags. The same users aren’t always the first to get new features.
- No database table tracking who’s in which cohort. The bucket is computed on the fly.
Bucket Input Priority #
The plugin determines the bucket input in this order:
- Explicit
bucketKey— if passed toisEnabled(), used directly - User ID — if the user is logged in
- Anonymous visitor cookie — a UUID stored in a first-party cookie (
_ff_vidby default)
If none of these are available (e.g., a console request with no user and no cookie), the rollout check is skipped and the flag returns false.
Anonymous Visitors #
For logged-out visitors, the plugin generates a UUID and stores it in a first-party cookie. This ensures the same visitor sees the same flag state across page views and return visits.
The cookie is configured in plugin settings or in a config file:
- Cookie name:
_ff_vid(configurable viaanonymousCookieName - TTL: 1 year (configurable via
anonymousCookieTtl) - Attributes:
httpOnly,secure(on HTTPS),sameSite=Lax,path=/
Set anonymousCookieTtl to 0 to disable cookie-based bucketing. Percentage rollouts will then only work for logged-in users.
Gradual Ramp-Up Strategy #
A typical rollout progression:
- 1% — smoke test with a tiny slice of real traffic
- 10% — validate metrics and watch for errors
- 25% — broader exposure, confirm performance at scale
- 50% — half your audience, monitor for a day or two
- 100% — full rollout, then clean up the flag
Each increase adds users without reshuffling existing ones.
Combining Rules and Rollouts #
Targeting rules and percentage rollouts work together:
- Rules are evaluated first. If any rule matches, the flag is enabled immediately
- If no rules match, the percentage rollout is checked
- If neither matches, the flag returns
false
This lets you do things like: “Enable for all internal staff (via user group rule) AND roll out to 10% of everyone else (via percentage).”