This topic describes how to use targeting rules to control variations that you want to serve to your users. Configuring which users see which variation of a flag is called targeting users with a flag. You can target users of your application, email addresses, systems, services, machines, resources, or anything else that can be uniquely identified.
In targeting, you can edit the default rules and also add custom rules to your feature flag. Custom rules serve specific targets differently.
You can edit rules and use the Targeting option in your feature flag to control which users see a variation of a feature flag.
Click on the feature flag for which you want to edit the rules.
In Targeting, click Edit Rules.You can edit the default rules and add custom rules.
Step: Edit Custom Rules
Custom rules serve specific targets differently. In Custom Rules, you can add the following rules:
Serve Variation to Target
On Request, check for condition and serve variation
Serve Variation to Target
Click Serve Variation to Target to select the variation for the specific target.
From the Serve drop-down list, select the variation.
Click + to specify the target to serve the variation.
Select the target and click Done.The Custom Rule is added. You can add multiple Serve Variation to Target custom rule to serve different variations for different targets.
Click Edit to modify the target to serve the variation.
Once you're done, click Save.
On Request, check for condition and serve variation
Harness Feature Flag allows you to target users based on custom attributes, which means you can control who sees features based on any criteria that you set.
Click On Request, check for condition and serve variation to add a condition to the variation for the specific target.
From the On Request drop-down list, select Identifier or Name.
Select the operator and values for your Custom Rule.
an operator, which sets differentiating characteristics of the attribute, such as limiting the attribute to emails that end with certain extensions.
The following operators are supported:
Operator
Attribute Type
Definition
starts with
string
string prefix match
ends with
string
string suffix match
contains
string
substring match
equals
number or string
matches the string or number
equals (sensitive)
number or string
matches the string and is case-sensitive. For example, the string HELLO is different from the string hello.
in
segment names
user is included or excluded by the targeting rules for the named segments.
Match Target Group
target group name
matches the rule in the named target group
a user value, which identifies a user or resource by a value you specify, such as @harness.io.
You can add multiple conditions to a rule. You can also choose to drag the rules up or down. The Targeting tab evaluates rules top-down. If a user matches multiple rules, the first matching rule applies.
Once you've finished setting up the conditions for your rule, you can decide whether your users will receive one variation or a percentage rollout across several variations. A common use case for percentage rollouts is to increment the percentage of users targeted by a flag over time until 100% of the users see one variation of a flag.
To do so, select the variation from the serve drop-down list.
Once you're done, click Save.
Percentage Rollouts
A common use case for percentage rollouts is to increment the percentage of users targeted by a flag over time until 100% of the users see one variation of a flag.
Instead of serving specific variations, you can use Percentage Rollout to distribute users dynamically between variations. At the time of evaluation, SDKs will use the variation based on the percentage defined.