---
title: "Percentage rollouts"
description: "Serve variations to a percentage of contexts, deterministically, by user or by account."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Percentage rollouts

A rule or the default rule can serve a **percentage rollout** instead of one variation: each
variation gets a weight, and each context gets one variation, the same one every time.

## Weights

Weights are integers in thousandths of a percent and add up to exactly **100000**: `25000` is
25%, `33333` is 33.333%. The console's slider works in whole percents.

```json
{
  "rollout": {
    "bucketBy": "targetingKey",
    "weights": [
      { "variation": "true", "weight": 25000 },
      { "variation": "false", "weight": 75000 }
    ]
  }
}
```

## Bucketing

A context's bucket comes from the flag's key and the **`bucketBy`** attribute, `targetingKey` unless
you name another. So:

- **The same context gets the same variation** on every evaluation and in every provider.
- **Bucketing by another attribute** (`companyId`) rolls out by account: everyone in an account
  gets the same variation.
- **Raising a variation's share keeps who already had it,** as long as the weights stay in the same
  order (the console and `ezgh flags rollout` keep it). Going from 10% to 25% adds contexts; nobody
  in the first 10% loses the variation.
- **Flags bucket independently:** being in one flag's 10% says nothing about another's.
- **A context without the `bucketBy` attribute gets the first variation with a non-zero weight,**
  and so does one whose `bucketBy` value isn't a string or an integer below 10<sup>15</sup> (a
  boolean, an object, a fraction).

## From the command line

For a flag with two variations, `ezgh flags rollout` sets the default rule: `--percent` goes to
`true` for a boolean flag, else to the flag's first variation or `--variation`. A default rule
that's already a rollout keeps its order and bucketing, and only its weights change.

```sh
ezgh flags rollout new-checkout --env production --percent 25 --comment "A quarter"
ezgh flags rollout new-checkout --env production --percent 25 --bucket-by companyId
ezgh flags rollout banner-color --env production --percent 10 --variation green
```

A rollout applies while the flag is on in that environment.

Source: https://docs.ezghcloud.com/flags/rollouts/index.mdx
