@@ -104,6 +104,52 @@ Segment rule properties:
104104 [ ` In ` ] ( ?operators=in#operator-details ) operator.
105105- ** Environment Name** : the name of your Flagsmith environment. Useful for restricting Segments to certain environments.
106106
107+ Context values can be used to control your targeting more precisely:
108+
109+ ### Gradual rollout across tenants
110+
111+ Suppose your application supports users who can belong to multiple organisations. Now imagine you want to roll out a new
112+ feature to 50% of your total user base — but instead of targeting users randomly, you'd like to gradually release the
113+ feature based on the organisations they belong to.
114+
115+ Here's how you might define a segment to achieve this:
116+
117+ | Rule Order | Property | Operator | Value |
118+ | ---------- | ------------------------- | -------- | ----- |
119+ | 1 | Identifier | % Split | 50 |
120+ | 2 | ` organisation_name ` Trait | % Split | 20 |
121+
122+ This setup instructs the evaluation engine to:
123+
124+ 1 . Check whether the user falls within the first 50% of your overall user base.
125+ 2 . If they do, check whether the organisation they belong to is within 20% of all organisations.
126+
127+ As you gradually increase the percentage in Rule 2, the number of users with access to the feature grows — but it will
128+ never exceed 50% of your total user base. If a user switches to an organisation that isn’t included in Rule 2, they’ll
129+ lose access to the feature.
130+
131+ :::info Use transient traits for multi-tenancy
132+
133+ To avoid persisting the ` organisation_name ` trait on the user identity, mark it as
134+ [ transient] ( ../advanced-use/transient-traits.md ) .
135+
136+ :::
137+
138+ ### Restrict evaluation to select environments
139+
140+ Segments and segment overrides are defined at the project level. This means they apply across all environments, so you
141+ may want to restrict your targeting to specific environments — for example, to avoid exposing features in production
142+ while still running complex evaluations in staging or development.
143+
144+ Here’s how you could define such a segment:
145+
146+ | Rule Order | Property | Operator | Value |
147+ | ---------- | ---------------- | ------------------- | ------------ |
148+ | 1 | Environment Name | Does Not Match (!=) | ` production ` |
149+ | 2 | Identifier | % Split | 20 |
150+
151+ This setup will enable the feature for 20% of users, but only in non-production environments.
152+
107153## Trait data types
108154
109155Each individual trait value is always stored as one of the following data types:
@@ -207,8 +253,8 @@ You can use Percentage Split to drive [A/B tests](/advanced-use/ab-testing) and
207253[ staged feature rollouts] ( /guides-and-examples/staged-feature-rollouts#creating-staged-rollouts ) .
208254
209255Percentage Split deterministically assigns an Identity to a bucket based on a provided [ context value] ( #context-values )
210- or a trait. This means that Segment overrides that use Percentage Split will always result in the
211- same feature value for a given identity in the chosen context.
256+ or a trait. This means that Segment overrides that use Percentage Split will always result in the same feature value for
257+ a given identity in the chosen context.
212258
213259If you create a Segment with a single Percentage Split rule of 10% over identifier, Identities who are members of that
214260split will be guaranteed to also be in that split if it is changed to a value higher than 10%.
0 commit comments