Skip to main content
Trackly SMS supports sophisticated audience segmentation with nested AND/OR logic. This guide explains how to combine conditions effectively.

Logic Basics

AND (All Must Match)

When conditions are combined with AND, a contact must satisfy every condition:
A contact must have:
  • Clicked in the last 7 days, AND
  • Received more than 3 messages, AND
  • Have custom_fields.state equal to “California”
Result: Only contacts meeting ALL criteria are included.

OR (Any Can Match)

When conditions are combined with OR, a contact must satisfy at least one condition:
A contact with custom_fields.state matching California, Texas, OR Florida is included. Result: Contacts meeting ANY criterion are included.

Condition Groups

Creating Groups

Groups let you combine AND and OR logic. Each group is evaluated first, then groups are combined. Structure:

Example: Engaged OR New

Target engaged contacts OR brand new signups:
Matches:
  • Recent multi-clickers (engaged users)
  • Brand new signups who haven’t been messaged

Common Patterns

Geographic Targeting

Target multiple states or regions:
For many values, consider using the in operator (e.g., custom_fields.state in ["CA", "TX", "FL", "NY"]) or creating a custom field like custom_fields.region eq "West" instead of listing states individually.

Engagement Tiers

Target by engagement level:

Revenue-Based Segments

Reply-Based Segments

Target contacts by their inbound replies — what they said, when they last replied, and how often. These conditions read the contact’s reply history captured in the Inbox.
(Reply-text matching is case-insensitive.)
Reply conditions match against the contact’s latest reply text and aggregate reply counts on ListContact. ne / not_contains require a reply to exist (contacts who never replied are excluded).

Re-Engagement

Target lapsed contacts who were once active:
Matches: Contacts who:
  • Have been messaged recently
  • Haven’t clicked in a month
  • BUT previously showed strong engagement

Exclusion Logic

Exclude certain contacts using NOT conditions:
Matches: New signups who are active (not unsubscribed) and haven’t been messaged today.

Advanced: Nested Groups

For complex logic, nest groups within groups:
Matches: Contacts in CA or TX who clicked recently AND clicked more than once.
Deeply nested groups (groups within groups) are supported in the data model but are not currently exposed in the UI. The UI supports one level of group nesting.

Evaluation Order

Conditions are evaluated in this order:
  1. Individual conditions within groups
  2. Groups combined (AND/OR between groups)
  3. Final audience membership
Example:
  1. Evaluate A AND B → Result 1
  2. Evaluate C AND D → Result 2
  3. Result 1 OR Result 2 → Final audience

Debugging Audiences

Audience Too Small

If your audience is smaller than expected:
  • Check that conditions aren’t too restrictive
  • Try removing conditions one at a time
  • Preview to see what’s filtering contacts out
  • Verify the field has data (e.g., custom_fields.state may be blank)

Audience Too Large

If your audience is larger than expected:
  • You may have OR where you meant AND
  • Check group logic (groups OR’d together include more)
  • Add additional qualifying conditions

Preview Tool

Always use the preview before sending:
  1. Click Preview in the audience builder
  2. Review the sample contacts
  3. Check if they match your intent
  4. Adjust conditions if needed

Performance Tips

Fields like last_clicked_at, send_count, and signup_date are stored on ListContact and are indexed for fast queries. Custom fields may be slower on large lists.Cross-collection lookups are slowest: Timezone, carrier, and DNC conditions require a $lookup join to the Contact collection, which is significantly slower than ListContact-only conditions. Use these sparingly in complex audiences.
Simple audiences with 2-3 conditions evaluate faster than deeply nested logic.
For audiences used frequently, the cached size updates periodically. Don’t refresh constantly.

Next Steps

Dynamic vs Static

Choose the right audience type

Campaign Targeting

Use audiences in campaigns