As explained in the core concepts section, target groups allow you to segment your users in different groups based on common attributes. Target groups allow you to set different setting values for different users in your application, grouping your users based on a set of rules.
Let's see how to create your first target group. Click on the Target Groups section on the sidebar.
Enter the name of the target group; you notice that the key will be complete automatically. The key must be unique in the project, is the way Koople identify your target group. If the key already exists, the platform will throw an error message when trying to create it, and the key must be changed to complete the process. Optionally, you can add a description to your target group.
Try naming your target groups with descriptive names. For instance "QA developers", the key will be automatically filled as "qa-developers". This naming will help you when coding, improving human readability.
When a target group is created, it is replicated in all environments. Similarly, when we create a new environment, it will already have all the target groups created in the same project other's environments.
Now it's time to create the rules to identify this group of users. When you click on the button "Create target group" you are redirected to the screen to define the group.
Let's start with a simple example. We are going to identify the group via email.
However, identifying users by email may not be enough, especially when identifying users' groups. For these cases, we will need to add identification rules. These rules are simple logic operators like exist, is one of, greater than, etc.
The complete list of operators:
- is one of
- is not one of
- doesn't exist
- does not contain
- is truthy
- is falsy
It is possible to combine different rule with and/or operators.
So, now we know how to create target groups. What can we do with these target groups?
If you have read the Release Toggles section or the Remote Config section you've noticed the rule operators can use target groups. Great! You got it! Now you can crate release toggles and remote config rules with target groups. That allows you to keep users grouped and reuse them in different toggles.