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.


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

Audience criteria group operators

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.

Criteria groups
Multiple criteria from different categories in their own criteria groups

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 CONTAINS cola

  • given name IS joe

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 than 100

  • event occurrence is greater than or equal to 5

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 after 01/01/2024

  • (function) event reported is in the last 12 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.

Switching between exact (value) and relative (function) dates in the audience criteria builder

Last updated

Was this helpful?