Use rules to assign variants. Rules decide which variant to use for a particular client and user at a given time. The purpose for a rule can be many: to do a rollout, turn on a feature for employees only, or to give users in a certain market a different experience. Importantly, rules execute in order from top to bottom. The first rule that matches determines what variant is assigned to the user. If no rule matches, the client uses the default value of the flag defined in the client.Documentation Index
Fetch the complete documentation index at: https://backstage.spotify.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Types of Rules
Three types of rules are available:- A general rule; the most flexible type of rule. Use when you want to assign a variant to a set of users based on a set of criteria.
- An override rule; used to force a specific variant for a set of users. Use it for testing and debugging.
- A rollout rule; used to assign a percentage of the traffic to a variant. Use when you want to gradually turn on a feature for a set of users.
General Rules
General rules are the most flexible type of rule. Use when you want to assign a variant to a set of users based on a set of criteria. A/B tests and other types of experiments use general rules. General rules have inclusion criteria, allocation, and randomization. See the audience page for more information on how to set these.Variant Assignment
The variant assignment defines how to assign variants to users. It specifies how much, as a percentage, of the traffic each of the variants should receive. The sum of the percentages can not be more than 100%. If the sum is less than 100%, the remaining traffic receives the default values in the clients.Override Rules
Use override rules to force a specific variant for a set of users. For example, use override rules for testing and debugging.Rollout Rules
Use rollout rules to assign a percentage of the traffic to a variant. Use them when you want to gradually turn on a feature for a set of users. The users that don’t match the rule, or that are not assigned to a variant by the rule, are assigned a variant based on a rule later in the list of rules, or the default value of the flag.Enable Rules
Rules are inactive when you create them. To enable a rule, click the slider button in the top left corner of the rule card.Order of Rules
The order of the rules defines in what order to evaluate them. The first rule that matches a client and a user decides the variant to use. You can reorder the rules by dragging them up and down in the list. Newly created rules are at the bottom of the list to not impact already running tests and rollouts.Create a General Rule
To create a general rule, follow these steps.- Go to Portal and select Confidence flags on the left sidebar.
- Go to the flag you want to add a rule to.
- Click + Create rule.
- Select General.
- Build the audience according to the steps on the audience page.
- Select how to split the traffic between the variants.
- Click Save.
- Enable the rule by clicking the toggle on the rule card.
Create an Override Rule
To create an override rule, follow these steps.- Go to Portal and select Confidence flags on the left sidebar.
- Go to the flag you want to add a rule to.
- Click + Create rule.
- Select Override.
- Select the variant to assign to the users that match the rule in the Variant section.
- Enter which field in the evaluation context that clients use pass the identify of the users in the Attribute section.
- Enter a list of values to match against. If the value of the field matches one of the values in the list, the rule matches and the variant is assigned.
- Click Save.
- Enable the rule by clicking the toggle on the rule card.

Create a Rollout Rule
To create a rollout rule, follow these steps.- Go to Portal and select Confidence flags on the left sidebar.
- Go to the flag you want to add a rule to.
- Click + Create rule.
- Select Rollout.
- Pick the variant to roll out.
- Build the audience according to the steps on the audience page.
- Set the allocation to decide what percentage should receive the variant.
- Click Save.
- Enable the rule by clicking the toggle on the rule card.