Abrova
☰ Docs menu · Targeting
Coming soon. Abrova Flags is coming soon. This page describes how it will work; it can’t be used yet.

Targeting Rules

Control which users see a feature based on their attributes. Define rules in the dashboard, send the user's attributes from your app, and Abrova Flags decides who gets the flag.

Last updated: 27 Oct 2026
Targeting Rules.

Targeting rules let you control which users see a feature based on their attributes. You define the rules in the dashboard and your app only says who the user is. Rules are never sent to apps or browsers.

How Targeting Works#

When you create a flag, you can define targeting rules as conditions on user attributes. The rules are checked against the context of the user: the user id, the anonymous id and the attributes you provide.

Client SDKs

The SDK sends the context to Abrova Flags, which checks the rules and returns the values for this user. A change of attributes fetches new values

Server SDKs

The SDK downloads the rules with the server secret and checks them locally against the context you pass with each call

Conditions are combined in a group with AND (all must match) or OR (at least one must match). If no targeting rules are defined, the flag applies to all users. A user who does not match gets the flag's off value with reason NOT_TARGETED.

Setting User Attributes#

Pass user attributes to the SDK so targeting rules can evaluate against them:

Client-Side SDKs

typescript
// React Native / Next.js (client)
await flags.identify('user-123', {
  plan: 'pro',
  country: 'US',
  age: 28,
  email: 'user@company.com',
});

// Later: replace the whole set of attributes
await flags.setAttributes({ plan: 'business', country: 'US' });
dart
// Flutter
await flags.identify('user-123', attributes: {'plan': 'pro', 'country': 'US'});
kotlin
// Android
flags.identify("user-123", mapOf("plan" to "pro", "country" to "US"))
swift
// iOS
flags.identify("user-123", attributes: ["plan": "pro", "country": "US"])
Attributes are replaced, not merged.

identify with attributes and setAttributes replace the whole set. Send every attribute your rules need each time. An attribute you leave out no longer exists for the rules.

Server-Side SDKs

typescript
// Node.js / Next.js (server) — pass context per evaluation
const isEnabled = flags.isEnabled('premium_feature', {
  userId: 'user-123',
  attributes: {
    plan: 'pro',
    country: 'US',
  },
});

What an attribute can be

LimitValue
Value typesString, number, boolean, null, or an array of those. No nested objects
Number of attributesAt most 100
Attribute name1 to 100 characters
String valueAt most 1,024 characters
ArrayAt most 100 items
userId and anonymousIdNot attributes. Rules on userId or anonymousId read the id of the context, and an attribute with one of these names is ignored

Attributes are sent to Abrova Flags with each fetch. Send what your rules need, and avoid personal data you do not target on.

Comparison Operators#

Targeting rules support these operators:

OperatorValueMatches when
equalsanyThe attribute equals the value
not_equalsanyThe attribute does not equal the value
inarrayThe attribute is one of the values
not_inarrayThe attribute is none of the values
containsstringThe attribute is a string that contains the value
not_containsstringThe attribute does not contain the value
starts_withstringThe attribute is a string that starts with the value
ends_withstringThe attribute is a string that ends with the value
regexstringThe attribute is a string and the pattern matches somewhere in it
greater_thannumberAttribute > value
less_thannumberAttribute < value
greater_than_or_equalnumberAttribute >= value
less_than_or_equalnumberAttribute <= value
existsbooleantrue: the attribute is present and not null. false: it is missing or null
in_segmentsegmentThe user matches the segment
not_in_segmentsegmentThe user does not match the segment

The rule builder in Abrova Console offers is, is not, is one of, is not one of, contains, greater than, less than, matches regex, exists, doesn't exist, is in segment and is not in segment.

How values are compared

  • Text comparison is case-sensitive: Pro does not equal pro.
  • A number and a numeric string are equal when the numbers are equal: 28 equals "28". The number operators also accept numeric strings.
  • A boolean equals the strings "true" and "false".
  • If the attribute is an array, a condition matches when any item matches. For example tags: ['beta', 'staff'] matches tags equals beta.
  • If the attribute is missing, equals, in, contains and the other positive operators do not match, and not_equals, not_in, not_contains and not_in_segment do match.
  • regex looks for the pattern anywhere in the value. Use ^ and $ to match the whole value.

Rule Examples#

A rule set is a group with an operator and a list of conditions. You build it in the dashboard; this is the shape the server SDKs receive:

json
{
  "operator": "AND",
  "rules": [
    { "attribute": "country", "operator": "in", "value": ["US", "CA", "UK"] },
    { "attribute": "plan", "operator": "equals", "value": "premium" }
  ]
}

Here are common patterns:

Country Targeting

json
{ "attribute": "country", "operator": "in", "value": ["US", "CA", "UK"] }

Plan-Based Access

json
{ "attribute": "plan", "operator": "equals", "value": "premium" }

Email Domain Targeting

json
{ "attribute": "email", "operator": "regex", "value": "@company\\.com$" }

Combined Rules (AND Logic)

json
{
  "operator": "AND",
  "rules": [
    { "attribute": "country", "operator": "in", "value": ["US", "CA"] },
    { "attribute": "plan", "operator": "equals", "value": "premium" },
    { "attribute": "age", "operator": "greater_than_or_equal", "value": 18 }
  ]
}

All three conditions must be true for the flag to be enabled for this user.

Either Condition (OR Logic)

json
{
  "operator": "OR",
  "rules": [
    { "attribute": "plan", "operator": "equals", "value": "enterprise" },
    { "attribute": "segment", "operator": "in_segment", "value": "beta-testers" }
  ]
}

A segment is a saved group of users defined by its own attribute conditions. The flag is enabled for enterprise users and for everyone in the beta-testers segment.

Targeting and Rollouts Together#

Targeting is checked before the rollout percentage. With rules for plan equals premium and a rollout of 20%, the flag is on for 20% of premium users and off for everyone else. See Percentage Rollouts and the Evaluation Flow.

Debugging a rule.

Read the reason of the flag with getDetail. NOT_TARGETED means the rules did not match the attributes that were sent. Check the spelling and the type of each attribute, and remember that setAttributes replaces all of them.

Was this page helpful?
Report a problem