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.
Security ConcernsEven though Floodgate requires data about your users to allow for targeted flag evaluations, it's important to understand that this data is never sent to the Floodgate servers. All evaluations are done locally in the SDK within your application.
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.
Add a new tagret
- Login to the Floodgate management console.
- Navigate to a flag that you want to target users for inside one of your application environments.
Enable user targeting by toggling on the Enable targeting switch.
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
- 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
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
- 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.
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.
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.