Targeting Users with Flags

Updated 4 months ago by Archana Singh

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.

In this topic:

Before You Begin

Visual Summary

Step: Targeting Users

You can edit rules and use the Targeting option in your feature flag to control which users see a variation of a feature flag.

  1. Click on the feature flag for which you want to edit the rules.
  2. In Targeting, click Edit Rules.
    You can edit the default rules and add custom rules.

Step: Edit Default Rules

Using default rules, you can specify to serve a specific variation, or apply a percentage rollout of a variation.

  1. In Default Rules, modify the variations for your flag.
  2. If you want to do a percentage rollout for the variation that is ON, select % Percentage Rollout from the drop-down list. A percentage rollout allows choosing a percentage of users to see each variation of the flag. You can increase or decrease the percentage over time.
  3. In Bucket by, select Identifier or Name.
  4. Allocate percentages for different variations.
  5. Once you're done, click Save.

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

  1. Click Serve Variation to Target to select the variation for the specific target.
  2. From the Serve drop-down list, select the variation.
  3. Click + to specify the target to serve the variation.
  4. 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.
  5. Click Edit to modify the target to serve the variation.
  6. 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.

  1. Click On Request, check for condition and serve variation to add a condition to the variation for the specific target.
  2. From the On Request drop-down list, select Identifier or Name.
  3. 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

    • 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.
  4. 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.
  5. 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.


Please Provide Feedback