Targeting users

Targeting users allows you to serve a very customised application experience to your users. User targeting is achieved in two parts. Firstly you need to create a User Object via the SDK within your application code, this will allow Floodgate to identify the user. Secondly you will crete user targeting rules in the Floodgate management console to return flag values based on the user properties.


Table of contents

Targeting specific users

You can use User Targeting to target specific users of your application. User targeting happens at the application environment level. This means you can target different groups of users for the same flag in different environments.

A target consists of one or more rules and a rule is made of up 3 parts.

  • Attribute
  • Comparator
  • Value

Add a new tagret

  1. Login to the Floodgate management console.
  2. Navigate to a flag that you want to target users for inside one of your application environments.
  3. Enable user targeting by toggling on the Enable targeting switch.

  4. You will be presented with the target rules form as shown below. Here you will enter the specific rules you want to target your users against. The example below shows a flag with two rule conditions targeting users from the US or UK who have a @floodgate.io email address. If a user if found matching those conditions the flag will be delivered to them with the value true.

  5. Once you have added your targets and rules save for flag configuration to have it delivered to your application.

Understanding targets and rules

Anatomy of a rule

A rule consists of 3 parts, an attribute, comparator and one or more values.

The attibute is the attribute that you assign to your user via the User Object custom attributes. Floodgate provides 2 core attributes out-of-the-box which you can use in your rules, these are id and email.

The comparator is how you want Floodgate to evaluate the users data. There are 4 available comparators to choose from.

  • Is equal to
  • Is not equal to
  • Contains
  • Does not contain

The rule values are the criteria you want to make sure your user matches. A rule can have one or more values and each value is evaluated as an OR condition. For example if you have the values UK and US in a rule, any user with the set attribute matching either UK or US would evaluate to true and deliver the configured value.

Managing rules

To add more rules to a target press the button. You will see a new blank rule appear.

Rules within a target are processed as an AND condition. For example if you have a rule checking a users country attribute is equal to UK and added a second rule to the target checking against the users subscription plan attribure is equal to Pro then both of these would need to evaluate to true for the user to be returned the configured value.

To add more values to the rule press the button. To remove a value press the corrisponding button.

To remove a rule from the target press the button.

Managing targets

To add a new target to press the button. You will be presented with a blank target screen. You can enter your rules as required.

Targets are evaluated one at a time in the order shown. Once a target evaluest to true the user is delivered the value set for that target and no other targets are processed thereafter.

To remove a target configuration, press the button.

If a user does not match any of the target rules then they will be delivered the default flag value.

Percentage rollouts