Skip to content

docs: Guide for complex segment rules (OR logic, nested conditions) #7204

@Holmus

Description

@Holmus

Problem

The segments documentation covers basic rule evaluation (sequential, top-to-bottom, AND logic) but doesn't explain how to build more complex targeting logic. Support tickets regularly come in from users trying to achieve OR-based targeting, multi-condition rollouts, or multi-tenant patterns, and they can't figure out how from the current docs.

These aren't confused beginners - they're power users who understand segments conceptually but need guidance on advanced patterns.

What's missing

  • OR conditions: How to combine multiple rules with OR logic instead of AND. If segments are AND-only, how to achieve OR behavior using multiple segments.
  • Compound boolean logic: Patterns for combining AND/OR across traits, identities, and percentages.
  • Multi-tenant targeting: Common pattern where customers want to roll out a feature to specific organizations/tenants using segments. This comes up frequently with B2B users.
  • Segment interaction: When multiple segments apply to the same feature via overrides, which one wins? The docs mention "first match" but don't give examples of how to structure segments to get the desired priority.
  • Percentage splits within segments: How percentage-based rollouts interact with segment overrides. Users frequently get unexpected results here.

Suggestion

Add an "Advanced Segments" or "Complex Targeting Patterns" guide, either as a section in the existing segments page or as a standalone guide. Focus on recipes/patterns rather than abstract explanations.

Example patterns to document:

  1. OR targeting: "I want to target users who are in region=EU OR have trait beta_tester=true"
  2. Staged rollout: "I want 10% of users in segment A but 50% of users in segment B"
  3. Multi-tenant rollout: "I want to enable a feature for specific organization IDs"
  4. Exclusion patterns: "I want everyone EXCEPT users with trait X"

Each pattern should include the concrete steps in the Flagsmith UI, not just the conceptual approach.

Why this matters

Users who are building complex targeting are typically deep into their Flagsmith integration and getting real value from the product. When they get stuck, they either open a support ticket, work around the limitation in their own code, or in the worst case decide the product can't do what they need. Good documentation here directly supports adoption and retention of engaged users.

Metadata

Metadata

Assignees

Labels

docsDocumentation updates

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions