Skip to content

Commit 488b985

Browse files
committed
Revise User Condition
1 parent 25cea63 commit 488b985

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

website/docs/targeting/targeting-rule/user-condition.mdx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ description: A User Condition is a condition that is based on the comparison of
66

77
## What is a User Condition?
88

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.
1010

1111
## How does the User Condition work?
1212

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.
1414

1515
For more details on the evaluation of User Conditions, please refer to [Feature Flag Evaluation](../../feature-flag-evaluation).
1616

1717
## How to set a User Condition?
1818

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.
2020

2121
<img src="/docs/assets/targeting/targeting-rule/user-condition/user-condition.png" width="700" alt="add user condition" decoding="async" loading="lazy"/>
2222

@@ -26,35 +26,35 @@ You can add a Targeting Rule with a condition on the Dashboard by clicking on th
2626

2727
A *User Condition* consists of three parts:
2828

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.
3030
- **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.
3232

3333
### Comparison Attribute
3434

35-
A property of your user (e.g. _email address_, _geographic location_). Your application should pass the attribute values (e.g. *jane&#64;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).
3636

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:
3838

39-
| Comparison attribute name | Description |
40-
| ------------------------- | ------------------------------------------------------------------------------ |
41-
| `Identifier` | Usually, it is a unique user identifier in your application. |
42-
| `Email` | The e-mail address of your user. |
43-
| `Country` | Might be useful for testing a new feature only in one country. |
44-
| `Custom` | Define any attribute (e.g. `OS version`), by typing its name into the textbox. |
39+
| Comparison attribute name | Description |
40+
| ------------------------- | ------------------------------------------------------------------------------------------------- |
41+
| 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. |
4545

4646
### Comparison Value
4747

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.
4949

5050
### Comparator
5151

52-
#### Confidential Text Comparators
52+
#### Confidential text comparators
5353

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.)
5555
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.
5656

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.
5858

5959
| Comparator | Description |
6060
| ------------------------------- | ------------------------------------------------------------------------------------------ |
@@ -67,12 +67,12 @@ The following comparators expect the *Comparison attribute* to be a string value
6767
| ENDS WITH ANY OF (hashed) | Checks whether the comparison attribute ends with any of the comparison values. |
6868
| NOT ENDS WITH ANY OF (hashed) | Checks whether the comparison attribute does not end with any of the comparison values. |
6969

70-
#### Text Comparators
70+
#### Text comparators
7171

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.
7373

7474
:::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.
7676
:::
7777

7878
| Comparator | Description |
@@ -89,11 +89,11 @@ Consider using Confidential text comparators if you plan to target users by thei
8989
| NOT CONTAINS ANY OF (cleartext) | Checks whether the comparison attribute does not contain any comparison values as a substring. |
9090

9191

92-
#### Semantic Version Comparators
92+
#### Semantic version comparators
9393

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.
9595

96-
Evaluation is based on <a target="_blank" href="https://semver.org/">the SemVer Semantic Version Specification</a>.
96+
Evaluation is based on the <a target="_blank" href="https://semver.org/">Semantic Versioning specification</a>.
9797

9898
| Comparator | Description |
9999
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
@@ -105,9 +105,9 @@ Evaluation is based on <a target="_blank" href="https://semver.org/">the SemVer
105105
| &gt;= (semver) | Checks whether the comparison attribute interpreted as a semantic version is greater than or equal to the comparison value. |
106106

107107

108-
#### Number Comparators
108+
#### Number comparators
109109

110-
The following comparators expect the *Comparison attribute* and the *Comparison value* to be numbers.
110+
The following comparators expect the comparison attribute and the comparison value to be numbers.
111111

112112
| Comparator | Description |
113113
| ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
@@ -119,18 +119,18 @@ The following comparators expect the *Comparison attribute* and the *Comparison
119119
| &gt;= (number) | Checks whether the comparison attribute interpreted as a decimal number is greater than or equal to the comparison value. |
120120

121121

122-
#### Date and Time Comparators
122+
#### Date and time comparators
123123

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.
125125

126126
| Comparator | Description |
127127
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
128128
| 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. |
129129
| 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. |
130130

131-
#### Array Comparators
131+
#### Array comparators
132132

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.
134134

135135
| Comparator | Description |
136136
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
@@ -145,7 +145,7 @@ The following comparators expect the *Comparison attribute* to be an array of st
145145
Black Friday is coming and we want to offer a special discount to our users.
146146

147147
#### 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.
149149

150150
#### Solution
151151
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
170170
We use ConfigCat in our Angular frontend application to control the availability of a feature.
171171

172172
#### 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.
174174

175175
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.
176176

177177
How can we solve this?
178178

179179
#### 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.
181181

182182
This way we can define the desired Targeting Rule using confidential comparators only.
183183

0 commit comments

Comments
 (0)