Audience query builder
Learn how to build audiences in the Loyalty Engine using the query builder, based on activity, profile, reward, and product data to create targeted and customised user groups.
The Loyalty Engine allows you to build audiences using various criteria based on different aspects of user data. Below are the types of criteria available for creating targeted and customisable audiences when using the query builder.
Data points
Activity data
Activity data refers to a user’s event stream and allows you to define criteria based on the actions they have taken within your program.
You can add the following activity data points to a criteria group:
Event type: Specifies the event type to consider for the data points below (e.g.,
PURCHASE_COMPLETED).If not specified, all event types will be included against the below data points
Event occurrence: Defines how many times the specified event type must have occurred.
Reported at: Filters events based on when they were reported (date and time).
Event payload: Specifies the information within the event’s payload using a JSON schema.
Profile data
Profile data includes all of the user’s core profile information and custom attributes. You can build audiences based on details such as:
Name, gender, location, or any other profile fields.
Custom attributes tailored to your loyalty program, like membership plans or preferences.
Reward data
Reward data relates to a user’s points balance and tier status. You can add the following reward data points to your audience criteria:
Current points: The user’s current points balance.
Points earned: The total number of points earned by the user, including those already spent.
Current tier name: The tier the user is currently in.
Points due to expire: How many points are due to expire for the user.
Points expiry period: The timeframe for expiring points, used with the 'points due to expire' data point above (e.g., “at least 100 points expiring in the next 30 days”).
Product data
Product data relates to the user’s product purchase history. You can add the following product data points to your criteria:
Brand purchased: Filters based on the brand of products purchased by the user.
Product purchased: Specifies particular products the user has bought.
Product unit price: Filters based on the price of purchased products.
Quantity purchased: Specifies how many units of a product the user has bought.
Grouping
When creating audience criteria, imagine utilising brackets in an equation to isolate specific parts. Grouping enables the combination of different types of data or multiple data points within the same type using AND, OR, and NOT operators. This approach is particularly useful when:
Integrating criteria from more than one data type, such as profile and activity data.
Employing multiple data points from a single data type, like using both event occurrence and event type in the activity data.
By grouping these rules together, you can effectively structure and refine your audiences.
The NOT/AND/OR operators appear at the top of each group of rules:
The selected function will appear in bright blue for AND/OR
If NOT is selected, it appears red
Inactive functions are dark blue

Organising criteria groups
When building criteria in the audience builder, you’ll see that the available data points are organised into different categories. It’s important not to mix data points from different categories within the same criteria group.
If you need to use criteria from multiple categories in your audience, create separate groups for each category.
Additionally, if you're creating a criteria that requires multiple events of different types to have occurred, use one criteria group per set of activity-based criteria.


Operators
Data point operators are used to define the specific conditions that data must meet in order for a rule or set of rules to apply. These operators vary based on the data point type and can include:
Text operators
Text-based operations include equals, does not equal, contains, does not contain, starts with, and ends with. They are used for filtering or identifying text data.
For example:
product purchased
CONTAINScolagiven name
ISjoe
Number operators
Number-based operators include equals, does not equal, greater than, less than, greater than or equal to, and less than or equal to.
For example:
points balance is
less than100event occurrence is
greater than or equal to5
Time operators
Time-based operators include before, after, between, and exact time. They are used to evaluate conditions related to dates and times.
You can choose to specify these as exact dates (value) or relative dates (function).
For example:
(value) event reported is
after01/01/2024(function) event reported is
in the last12 months
To switch between exact (value) or relative (function) dates, choose the drop down arrow displayed to the immediate right alongside the time operator you choose.

Last updated
Was this helpful?