You can filter contacts in the customer filter using custom fields defined on orders and order line items. This lets you build segments based on data your business sends to Ometria alongside each order, such as loyalty points, order type, or discount indicators.
Note: Order and order line item custom fields only appear in the customer filter if they have Segmentation visibility enabled. You set this when creating the custom field.
Before you start
Make sure you have:
- Created the custom field in Settings > Custom fields with Segmentation visibility enabled. See: Create a custom field.
- Sent order data containing values for the custom field. You can only filter on data sent after the custom field was created.
Adding an order custom field condition
- Go to Customer > Segment explorer and select Filter.
- In the customer filter, select + Add condition.
- Select Purchase Activity from the left-hand menu.
- Inside the order node ("Has an order with the following details"), you will see three sections:
- Order details - the standard order conditions (products purchased, total spent, order date, etc.)
- Order custom fields - custom fields with scope Order
- Order line item custom fields - custom fields with scope Order line items
- Select the custom field you want to filter by.
- Choose an operator and enter a value.
Operators by field type
The operators available depend on the field type you chose when creating the custom field.
| Field type | Available operators | Example |
|---|---|---|
| String | is, is not, is one of, is not one of, contains, does not contain, which is known, which is not known | Order source is "web" |
| Integer | greater than, greater than or equal to, equal to, not equal to, less than or equal to, less than, between, not between, which is known, which is not known | Loyalty points spent greater than 500 |
| Decimal | Same as Integer | Discount percentage between 0.1 and 0.5 |
| Datetime | in the last, in the next, more than, before, after, on, between, day of month is, day of week is, month is, year is, which is known, which is not known | Fulfilment date in the last 30 days |
| Boolean | is true, is false, which is known, which is not known | Is employee is true |
| List of strings | which contains one of, which does not contain one of, which is known, which is not known | Favourite brands contains one of "Nike", "Adidas" |
| Single choice (Enum) | which is, which is not, which is one of, which is not one of, which is known, which is not known | Membership tier is one of "Gold", "Platinum" |
Boolean fields appear as a dropdown with two options (Yes / No). Single choice (Enum) fields appear as a dropdown of the values you defined when creating the field.
Using aggregation with numeric custom fields
Numeric custom fields (Integer and Decimal) are available in the aggregation block of the customer filter. This lets you filter contacts based on the sum or average of a numeric field across their orders.
To use aggregation:
- Add an order condition to the customer filter as described above.
- Select Filter number of occurrences to expand the aggregation options.
- In the "Show customers where the" row, select sum or average from the first dropdown.
- In the "of" dropdown, select the numeric custom field you want to aggregate. Order custom fields and order line item custom fields are listed in separate groups.
- Choose an operator and enter a value.
For example, to find contacts whose average loyalty points spent per order is greater than 200, select average of Loyalty points spent is greater than 200.
Note: Sum and average aggregation is also available for total spend and other standard numeric fields, not just custom fields.
Order vs order line item fields
Order custom fields and order line item custom fields are listed in separate sections in the customer filter, so you can see which scope a condition targets.
If a custom field with the same name exists on both the order and the order line item, they appear separately. Make sure you select the one that matches the scope of the data you want to filter by.
See also:
Comments
0 comments
Please sign in to leave a comment.