User Segmentation & Rules
A segment can be defined as a dynamic user group. User segmentation determines the user's segment at runtime and provides features such as displaying prices and stock based on that segment. When defining a segment, you need to input the segment's rule. This rule is applied to the user to determine their segment. If the rule returns True, it means the user fits into that segment. If the value is False, it means the user does not fit the segment's rule.
When determining a user's segment, the tested segment's rule is applied. If the user fits the rule of that segment, their segment is determined. A user can fit the rules of multiple segments, which is why there is a "priority" field in segments. This field indicates which segment takes priority when determining the user's segment. The lower the priority number, the higher the priority. For example, a segment with a priority of 5 takes precedence over a segment with a priority of 9. To manage the active or inactive status of a segment, there is an "is_active" field. If a segment is deactivated, it will not be tested when determining a user's segment. If a segment should be active during specific dates, you should specify the desired date range when creating the segment.
If a segment has a defined price list, only products with prices listed in that segment will be visible to the user. If you want customers in this segment to see the shop's price list, you should leave the price list field empty. Similarly, if a segment has a defined stock list, only products with stock listed in that segment will be visible to the user. If you want customers in this segment to see the shop's stock list, you should leave the stock list field empty.
Questions & Answers
1. How can I determine which segment I belong to?
You can check which segment you belong to by making a request to "/baskets/basket/?format=json," and you will see your segment in the response. The IDs of the price and stock lists here correspond to the IDs of these lists in the shop.
Example Segment Structure:
2. In what order do segments work, and how can I understand it?
To determine the order in which segments work, go to the back-office of the relevant brand, select "Active" in the Status filter on the segment listing screen, and then click on the "Customer Group Priority" column header to sort by priority value from lowest to highest. This sorting defines the order in which segments are applied to users.
3. I'm not seeing the prices I should see. Why is the segment not working?
First, make sure you are part of that segment. You might have joined a segment with a higher priority, so you may not see the expected prices and stocks.
4. I made changes to a segment, but I can still belong to the same segment. Why?
Changes made to segments (creating a new segment, activating/deactivating, changing price/stock lists, changing rules, etc.) may take 5-10 minutes to reflect in the shop due to the caching structure used.
5. I'm trying to add a product with available stock to the cart, but I can't. Why?
The absence of price or stock records for a product linked to a segment can cause this issue.
6. Before assuming a technical problem, what should I check for a problem related to a segment?
First, you should be aware of the segment you are a part of and the price and stock lists associated with that segment. Then, ensure that the product you are looking at and any linked gift products have the correct price and stock records in the relevant lists. If everything is correct and you still face issues, you can contact the Bridge team.
Rules
1. Liquer Rule
This rule allows access to and comparison of values on the user or request.
Parameters: query, value
Example:
2. True Rule
This is a rule that always returns "True" for every user. It can be used, for example, to gather users who are not included in any segment.
Parameters: No parameters required.
Example:
3. False Rule
This is a rule that always returns "False" for every user.
Parameters: No parameters required.
Example:
4. Guest Rule
This is a rule that returns "True" for users who are not logged in (anonymous) or have a user_type value of "guest."
Parameters: No parameters required.
Example:
5. Order Count Rule
This rule operates based on the number of orders created by the user within X days. In the example below, if a user has created between 10 and 20 orders (including 10 and 20) in the last 90 days, they will be included in this segment.
Parameters: lower_limit (lower bound), upper_limit (upper bound - optional), duration (number of days for backward calculation - optional)
Example:
6. Order Amount Rule
This rule operates based on the total amount of orders created by the user within X days. In the example below, if a user's total order amount is between 5000 and 10000 (including 5000 and 10000) in the last 90 days, they will be included in this segment.
Parameters: lower_limit (lower bound), upper_limit (upper bound - optional), duration (number of days for backward calculation - optional)
Example:
7. Group Rule
This is a rule that returns "True" for users in a specific user group. Each user can belong to multiple groups, and group settings can be managed from Sales Channel Settings > Customer Groups > Customer Groups page.
Parameters: name (group name)
Example:
8. Not Rule
The "not" rule returns "True" when the sub-rule returns "False."
For example, in the following rule definition, a user is included in the segment if the client type they used for the application is not the default. (Client types are default (web), ios, android, and instore. In this example, users from ios, android, and instore will be included in the segment.)
Parameters: child (sub-rule)
Example:
9. Email Extension Rule
This rule operates based on the extension of the user's email address. For example, if the user's email address ends with "@gmail.com" or "@akinon.com," they will be included in the segment.
Example:
10. Currency Rule
This rule operates based on the currency selected by the user.
For example, in the following rule definition, the user will be included in the segment when they choose Turkish Lira or Euro as their currency.
Example:
11. Segment Order Limit Rule
This rule does not work for non-registered users. A user who was included in a segment until X days ago and has placed orders less than a certain limit within the last 90 days will be included in this segment.
For example, in the following rule definition, if a user who was previously included in a segment has placed more than 5 orders in the last 90 days, they can no longer be included in this segment. This defines the order limit a user can have within a segment.
Example:
12. Segment Order Amount Limit Rule
This rule does not work for non-registered users. A user who was included in a segment until X days ago and whose total order amount within the last 90 days is less than a certain limit will be included in this segment.
For example, in the following rule definition, if a user who was previously included in a segment has a total order amount of more than 5000 in the last 90 days, they can no longer be included in this segment. This defines the order amount limit a user can have within a segment.
Example:
13. Segment Order Item Product Attribute Limit Rule
This rule does not work for non-registered users. A user who was included in a segment until X days ago and has ordered up to a certain limit of a product with the defined "attributevalue" within the last 90 days will be included in this segment; otherwise, they will not be included.
For example, in the following rule definition, if a user who was previously included in a segment has a total of 5 orders of a product with a color attribute of blue in the last 90 days, the user cannot be included in this segment. This defines the product attribute limit a user can have within a segment.
Example:
Multiple Rule Definitions
In this section, multiple rules can be defined simultaneously.
1. And Rule
The "and" rule returns "True" when all sub-rules return "True."
Parameters: children (list of sub-rules)
For example, in the following rule definition, if a user has more than 10 orders and at the same time, the total amount of orders they placed is more than 1000, they will be included in this segment.
Example:
2. Or Rule
The "or" rule returns "True" when at least one of the sub-rules returns "True."
Parameters: children (list of sub-rules)
For example, in the following rule definition, if a user has more than 10 orders or the total amount of orders they placed is more than 1000, they will be included in this segment.
Example:
Last updated
Was this helpful?