Skip to main content

Segments Reference

Core Concepts

Segment

A subset of identities defined by rules that match identity traits. Each segment:

  • Belongs to a single environment
  • Contains one or more rules
  • Can override feature states
  • Can be project-wide or feature-specific

Segment Rule

A condition that determines segment membership based on identity traits:

  • Evaluated in order (top to bottom)
  • Can use multiple operators
  • Supports various data types
  • Can be combined with AND/OR logic

Data Types

Trait Types

TypeDescriptionExample Value
StringText values"user@example.com"
BooleanTrue/false valuestrue
IntegerWhole numbers42
FloatDecimal numbers3.14

Type Coercion Rules

From TypeTo TypeCoercion Rules
String → Boolean"true", "True", "1"true
String → IntegerParsed as base-10
String → FloatParsed as decimal

Operators

Comparison Operators

OperatorDescriptionExampleData Types
=Exact matchage = 21All
!=Not equalcountry != USAll
>Greater thanlogins > 10Number
>=Greater than/equalspent >= 100Number
<Less thanage < 18Number
<=Less than/equalversion <= 2.1Number

String Operators

OperatorDescriptionExample
ContainsSubstring matchemail Contains @company.com
Does not containNo substring matchplan Does not contain free
Matches regexRegex pattern matchemail Matches .*@gmail\.com
InList membershipcountry In US,UK,CA

Special Operators

OperatorDescriptionExample
% SplitPercentage bucket% Split = 25
Is setTrait existspremium_until Is set
Is not setTrait doesn't existtrial_ended Is not set
SemVerVersion comparisonversion SemVer >= 2.1.0
ModuloDivision remainder`user_id % 2

SDK Version Requirements

SDKModuloIn
Python2.3.03.3.0
Java5.1.07.1.0
.NET4.2.05.0.0
Node.js2.4.02.5.0
Ruby3.1.03.2.0
PHP3.1.04.1.0
Go2.2.03.1.0
Rust0.2.01.3.0
Elixir1.1.02.0.0

System Limits

ResourceLimit
Segments per project100
Segment overrides per environment100
Rules per segment override100
Segment rule value size1000 bytes

Evaluation Precedence

  1. Identity Override
  2. Segment Override (first matching)
  3. Environment Default

Performance Characteristics

Local Evaluation

  • Sub-millisecond evaluation time
  • No network requests
  • Rules evaluated in-memory
  • Linear scaling with rule count

Remote Evaluation

  • Network latency dependent
  • Cached segment results
  • Server-side evaluation
  • Constant time regardless of rule count