FeatureSignals

Targeting & Segments

Targeting lets you deliver different flag values to different users based on their attributes. Segments are reusable groups of targeting conditions.

Create and manage segments in the Flag Engine →

Targeting Rules

ComponentDescription
ConditionsAttribute-based filters (e.g., country equals "US")
Segment KeysReference to reusable segments
ValueThe value to return when the rule matches
PercentagePercentage of matching users to target (basis points: 0–10000)
PriorityEvaluation order (lower = evaluated first)
Match Typeall (AND logic) or any (OR logic)

Operators

OperatorKeyDescription
EqualseqExact match
Not EqualsneqInverse match
ContainscontainsSubstring match
Starts WithstartsWithPrefix match
Ends WithendsWithSuffix match
IninValue is in the list
Not InnotInValue is not in the list
Greater ThangtNumeric comparison
Less ThanltNumeric comparison
RegexregexRegular expression match
ExistsexistsAttribute is present

Example: Target Beta Users in the US

json
{
  "rules": [
    {
      "priority": 1,
      "description": "Beta users in US",
      "match_type": "all",
      "conditions": [
        {"attribute": "country", "operator": "eq", "values": ["US"]},
        {"attribute": "beta", "operator": "eq", "values": ["true"]}
      ],
      "value": true,
      "percentage": 10000
    }
  ]
}

Segments

Segments are reusable groups of conditions that can be referenced by multiple flags.

bash
curl -X POST https://api.featuresignals.com/v1/projects/$PROJECT_ID/segments \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "enterprise-users",
    "name": "Enterprise Users",
    "description": "Users on enterprise plan",
    "match_type": "all",
    "rules": [
      {"attribute": "plan", "operator": "eq", "values": ["enterprise"]}
    ]
  }'

Evaluation Order

  1. Sort rules by priority (lowest first)
  2. For each rule: check segments, then conditions
  3. If match and percentage == 10000: return rule value (TARGETED)
  4. If match and percentage > 0: check user's hash bucket (ROLLOUT if in range)
  5. If no rule matches: check default percentage rollout
  6. If nothing matches: return flag's default value (FALLTHROUGH)

Next Steps