User Segment Targeting

Flags can have targeting rules to serve specific variants to user groups based on attributes:

1

Define Rules

Set rules in the dashboard using attributes (e.g., jobTitle = "QA Tester").

User segment targeting rule creation

Learn more about targeting in Flags: User Segments.

2

Evaluate Clauses

Within a rule, clauses use logical OR—e.g., serve “Enabled” to users with jobTitle of “QA Tester” or “PM”.

import { FlagSyncFactory } from '@flagsync/js-sdk';


const factory = FlagSyncFactory({

  sdkKey: 'your-sdk-key',

  core: {

    key: 'user123',

    attributes: { jobTitle: 'QA Testers' }

  }

});
3

Apply First Match

If a flag has multiple rules, the first matching rule determines the variant served.

4

Halt Evaluation

A matched rule stops further evaluation; otherwise, it proceeds to Rollouts.

Next Steps

Continue exploring flag evaluation: