How rollout works
When a flag is of type rollout, CanaryGate determines whether a specific user should see the feature based on:
- The user’s userId (passed in the SDK options or implicit)
- The flag key (
key) - The percentage configured in the dashboard
The calculation uses a deterministic hash: the same user with the same userId will always receive the same result for the same percentage. This ensures stickiness — the user does not alternate between versions.
Configuring in the SDK
const canary = new CanaryGate('cg_api_key', {
userId: currentUser.id // or a stable anonymous string
})
await canary.init()
const flag = canary.getFlag('new-dashboard')
if (flag?.enabled) {
// this user is in the rollout
}If you do not pass a userId, the SDK uses a stable anonymous ID generated and
persisted in localStorage (browser) or in memory (Node.js). Anonymous users
are also handled deterministically.
Increasing the percentage
Typical canary deploy workflow:
| Phase | Percentage | Action |
|---|---|---|
| Beta | 5% | Monitor metrics and errors |
| Expansion | 25% | Confirm stability |
| Ramp | 50% | Half the traffic |
| GA | 100% | Feature available to everyone |
Each percentage adjustment is delivered in real time via SSE to all connected clients.
Manual vs automatic rollout
- Manual: You adjust the percentage manually through the dashboard
- Automatic (Pro plan): Configure a schedule that increases the percentage automatically at defined times
See Schedule and Auto-rollout for more details.
Last updated on