You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/targeting/targeting-rule/user-condition.mdx
+32-32Lines changed: 32 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@ description: A User Condition is a condition that is based on the comparison of
6
6
7
7
## What is a User Condition?
8
8
9
-
A *User Condition* is a condition that is based on the comparison of a user attribute and a preset value (*comparison value*). It allows you to define Targeting Rules which target users based on their properties.
9
+
A *User Condition* is a condition that is based on the comparison of a user attribute (*comparison attribute*) and a preset value (*comparison value*). It allows you to define Targeting Rules which target users based on their properties.
10
10
11
11
## How does the User Condition work?
12
12
13
-
The *comparison attribute*'s value from the [User Object](../../user-object) is compared to the *comparison value* you set on the Dashboard. The comparison is done according to the selected comparator and will result in true or false. This will be the result of the condition.
13
+
The comparison attribute's value from the [User Object](../../user-object) is compared to the comparison value you set on the Dashboard. The comparison is done according to the selected comparator and will result in true or false. This will be the result of the condition.
14
14
15
15
For more details on the evaluation of User Conditions, please refer to [Feature Flag Evaluation](../../feature-flag-evaluation).
16
16
17
17
## How to set a User Condition?
18
18
19
-
You can add a Targeting Rule with a condition on the Dashboard by clicking on the `+IF` ("Add Targeting Rule") button. Add more conditions by clicking on the `+AND` button.
19
+
You can add a Targeting Rule with a condition on the Dashboard by clicking on the **+IF** ("Add Targeting Rule") button, then add more conditions by clicking on the **+AND** ("Add AND condition") button.
20
20
21
21
<imgsrc="/docs/assets/targeting/targeting-rule/user-condition/user-condition.png"width="700"alt="add user condition"decoding="async"loading="lazy"/>
22
22
@@ -26,35 +26,35 @@ You can add a Targeting Rule with a condition on the Dashboard by clicking on th
26
26
27
27
A *User Condition* consists of three parts:
28
28
29
-
-**Comparison attribute:** The user attribute on which the condition is based. Could be "User ID", "Email", "Country", or any custom attribute.
29
+
-**Comparison attribute:** The user attribute on which the condition is based. Can be **Identifier** (user ID), **Email**, **Country**, or any custom attribute.
30
30
-**Comparator:** The comparison operator that defines the relation between the comparison attribute and the comparison value.
31
-
-**Comparison value:** The preset value to which the comparison attribute is compared. Depending on the comparator, could be a string, a list of strings, a number, a semantic version, a list of semantic versions or a date.
31
+
-**Comparison value:** The preset value to which the comparison attribute is compared. Depending on the comparator, can be a string, a list of strings, a number, a semantic version, a list of semantic versions or a date.
32
32
33
33
### Comparison Attribute
34
34
35
-
A property of your user (e.g. _email address_, _geographic location_). Your application should pass the attribute values (e.g. *jane@example.com*, _Europe_) to the ConfigCat SDK as a [User Object](../../user-object).
35
+
A property of your user (e.g. email address, geographic location, etc.) Your application should pass the attribute values (e.g. `'jane@example.com'`, `'Europe'`, etc.) to the ConfigCat SDK as a [User Object](../../user-object).
36
36
37
-
There are 3 predefined attributes. Additionally, you can define your **_custom attributes_** as well:
37
+
There are 3 predefined attributes. Additionally, you can define your custom attributes as well:
| Identifier | Usually, it is a unique user identifier in your application.|
42
+
| Email | The e-mail address of your user.|
43
+
| Country |The location of your user. Might be useful for testing a new feature in specific countries only.|
44
+
| Custom |Any additional attribute (e.g. **OS version**). Can be defined by typing its name into the textbox. |
45
45
46
46
### Comparison Value
47
47
48
-
A string, a list of strings, a number, a semantic version, a list of semantic versions or a date value. Will be compared to the selected _Comparison attribute_ using the _Comparator_. The length of the _Comparison value_ is limited, and the limit depends on your subscription plan. See the [plan limits page](../../../subscription-plan-limits) for more details.
48
+
A string, a list of strings, a number, a semantic version, a list of semantic versions or a date value. Will be compared to the selected comparison attribute using the comparator. The length of the comparison value is limited, and the limit depends on your subscription plan. See the [Subscription Plan Limits page](../../../subscription-plan-limits) for more details.
49
49
50
50
### Comparator
51
51
52
-
#### Confidential Text Comparators
52
+
#### Confidential text comparators
53
53
54
-
We recommend using confidential text comparators when targeting users based on their sensitive data (like email address, name, etc).
54
+
We recommend using confidential text comparators when targeting users based on their sensitive data (like email address, name, etc.)
55
55
In this case, the feature flag evaluation is performed using the SHA256 hashes of the values to ensure that the comparison values are not exposed. This can cause an increase in the size of the config JSON file and the overall network traffic. Yet it is not recommended to use the cleartext version of the confidential comparators unless the increased network traffic becomes an issue.
56
56
57
-
The following comparators expect the *Comparison attribute* to be a string value and the *Comparison value* to be a string or a list of strings. The comparison is case-sensitive.
57
+
The following comparators expect the comparison attribute to be a string value and the comparison value to be a string or a list of strings. The comparison is case-sensitive.
@@ -67,12 +67,12 @@ The following comparators expect the *Comparison attribute* to be a string value
67
67
| ENDS WITH ANY OF (hashed) | Checks whether the comparison attribute ends with any of the comparison values. |
68
68
| NOT ENDS WITH ANY OF (hashed) | Checks whether the comparison attribute does not end with any of the comparison values. |
69
69
70
-
#### Text Comparators
70
+
#### Text comparators
71
71
72
-
The following comparators expect the *Comparison attribute* to be a string value and the *Comparison value* to be a string or a list of strings. The comparison is case-sensitive.
72
+
The following comparators expect the comparison attribute to be a string value and the comparison value to be a string or a list of strings. The comparison is case-sensitive.
73
73
74
74
:::info
75
-
Consider using Confidential text comparators if you plan to target users by their sensitive data, e.g.: email address or company domain.
75
+
Consider using confidential text comparators if you plan to target users based on their sensitive data, e.g. email address or company domain.
76
76
:::
77
77
78
78
| Comparator | Description |
@@ -89,11 +89,11 @@ Consider using Confidential text comparators if you plan to target users by thei
89
89
| NOT CONTAINS ANY OF (cleartext) | Checks whether the comparison attribute does not contain any comparison values as a substring. |
90
90
91
91
92
-
#### Semantic Version Comparators
92
+
#### Semantic version comparators
93
93
94
-
The following comparators expect the *Comparison attribute* to be a string containing a valid semantic version and the *Comparison value* to be a semantic version or a list of semantic versions.
94
+
The following comparators expect the comparison attribute to be a string containing a valid semantic version and the comparison value to be a semantic version or a list of semantic versions.
95
95
96
-
Evaluation is based on <atarget="_blank"href="https://semver.org/">the SemVer Semantic Version Specification</a>.
96
+
Evaluation is based on the <atarget="_blank"href="https://semver.org/">Semantic Versioning specification</a>.
@@ -119,18 +119,18 @@ The following comparators expect the *Comparison attribute* and the *Comparison
119
119
|>= (number) | Checks whether the comparison attribute interpreted as a decimal number is greater than or equal to the comparison value. |
120
120
121
121
122
-
#### Date and Time Comparators
122
+
#### Date and time comparators
123
123
124
-
The following comparators expect the *Comparison attribute* to be a date value (a second-based [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) or a platform-specific date object), and the *Comparison value* to be a date.
124
+
The following comparators expect the comparison attribute to be a date value (a second-based [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) or a platform-specific date object) and the comparison value to be a date.
| BEFORE | Checks whether the comparison attribute interpreted as a second-based [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) is less than the comparison value. |
129
129
| AFTER | Checks whether the comparison attribute interpreted as a second-based [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time) is greater than the comparison value. |
130
130
131
-
#### Array Comparators
131
+
#### Array comparators
132
132
133
-
The following comparators expect the *Comparison attribute* to be an array of strings (or an array of strings serialized to JSON), and the *Comparison value* to be a list of strings. The comparison is case-sensitive.
133
+
The following comparators expect the comparison attribute to be an array of strings (or an array of strings serialized to JSON) and the comparison value to be a list of strings. The comparison is case-sensitive.
@@ -145,7 +145,7 @@ The following comparators expect the *Comparison attribute* to be an array of st
145
145
Black Friday is coming and we want to offer a special discount to our users.
146
146
147
147
#### Goal
148
-
The deals should become available at midnight on Black Friday. We want to make sure that the users can't access the deals before that. And the deal should be available for the whole weekend.
148
+
The deal should become available at midnight on Black Friday. We want to make sure that the users can't access the deal before that. Also, the deal should be available for the whole weekend.
149
149
150
150
#### Solution
151
151
Let's use the AFTER comparator to check whether the current time is after midnight on Black Friday AND the current time is BEFORE midnight on Sunday.
@@ -170,14 +170,14 @@ const value = await configCatClient.getValueAsync("enableBlackFridayDeals", fals
170
170
We use ConfigCat in our Angular frontend application to control the availability of a feature.
171
171
172
172
#### Goal
173
-
We want to enable this feature for users from certain companies. To do the job, we would need to use the `CONTAINS` or `NOT CONTAINS` comparators.
173
+
We want to enable this feature for users from certain companies. To do the job, we would need to use the CONTAINS or NOT CONTAINS comparators.
174
174
175
175
However, there is no confidential version of these comparators and we are well aware that, for privacy reasons, it's not a good idea to use cleartext comparators for applications running in the browser.
176
176
177
177
How can we solve this?
178
178
179
179
#### Solution
180
-
Let's work around the problem by extracting the domain part of the email and pass it as a custom attribute named e.g. `domain` to the ConfigCat SDK.
180
+
Let's work around the problem by extracting the domain part of the email and passing it as a custom attribute named **domain** to the ConfigCat SDK.
181
181
182
182
This way we can define the desired Targeting Rule using confidential comparators only.
0 commit comments