Docs/Concepts/

Targeting

Control exactly who sees a feature using rules, operators, and target lists

Targeting lets you control which users see a feature. Instead of a simple on/off toggle, you define rules that evaluate against the user's context to decide which variation to serve.

How targeting works

When a flag is evaluated, the SDK checks each targeting rule in priority order. The first rule that matches determines the returned variation. If no rules match, the rollout percentage and default variation are used instead.

Request comes in with context: { userId: "u-42", plan: "enterprise", country: "US" }

Rule 1 (priority 0): plan eq "enterprise"  → variation 0 (true)   ✅ MATCH → return true
Rule 2 (priority 1): country in ["US","CA"] → variation 0 (true)  ⬜ skipped
Default variation                                                   ⬜ skipped

Rule structure

Each targeting rule has four parts:

PartDescriptionExample
AttributeThe context property to checkplan, email, country
OperatorHow to compareeq, contains, in
ValueThe value to compare against"enterprise", ["US", "CA"]
VariationWhich variation to return when the rule matches0 (first variation)

Rules also have a priority (lower number = higher priority). Rules are evaluated in priority order and the first match wins.

Operators

Flagpool supports eight operators across three categories:

String operators

OperatorDescriptionExample
eqEqualsplan eq "enterprise"
neqNot equalsplan neq "free"
containsString contains substringemail contains "@company.com"
startsWithString starts with prefixuserId startsWith "admin-"

List operators

OperatorDescriptionExample
inValue is in listcountry in ["US", "CA", "UK"]
ninValue is not in listcountry nin ["CN", "RU"]

Target list operators

OperatorDescriptionExample
inTargetListValue exists in a named target listuserId inTargetList "beta-testers"
notInTargetListValue does not exist in a named target listuserId notInTargetList "blocked-users"

Target lists

Target lists are named collections of string values with an attribute key, such as user IDs, email addresses, account identifiers, or other identifiers. The dashboard stores them and makes them available to targeting rules.

Target lists are managed in the dashboard under Target Lists. When exported to the CDN, they are AES-256-GCM encrypted by default. Encryption protects target-list values in the exported payload; flag definitions and targeting rules are not encrypted, and clients that decrypt a list can inspect its values.

An encrypted target-list export requires both the environment's decryptionKey and a platform-specific crypto adapter registered before SDK initialization. See the complete crypto adapter guide for every SDK and runtime. Feature flags and target-list rules are not authorization controls; enforce permissions and entitlements on the server.

Combining rules

You can add multiple rules to a single flag. Rules are independent — each one is evaluated separately in priority order.

Example: Give enterprise users the full feature, give pro users a limited version, and show the default to everyone else.

PriorityRuleVariation
0plan eq "enterprise"Full feature (variation 0)
1plan eq "pro"Limited feature (variation 1)
—DefaultBasic feature (variation 2)

Combining targeting with rollouts

Targeting rules and percentage rollouts work together:

  1. Rules are checked first — if a rule matches, its variation is returned regardless of rollout
  2. If no rules match, the rollout percentage determines whether the user gets the "on" or "off" variation

This lets you do things like "always show the feature to enterprise users, but only roll out to 10% of free users."

Next steps

Start Managing Feature Flags Today

Join teams who trust Flagpool to deliver features safely and efficiently.

No credit card required • Cancel anytime