> For the complete documentation index, see [llms.txt](https://help.littledata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.littledata.io/event-editor/trigger-conditions.md).

# Filter events with trigger conditions

Set up rules for an event to be sent only on matching conditions.

By default, every enabled event fires on every matching interaction. You can use trigger conditions to control when an event is sent to their destination.

{% hint style="info" %}
Trigger conditions let you send an event only under specific conditions, e.g. high-value purchases, or to exclude test orders.

If you want to stop an event completely, you can [disable the event](/event-editor/enable-disable-events.md) instead.
{% endhint %}

### What you can do with it

Filtering events are very helpful for removing noise from the events so your analytics data is cleaner and ad platforms don't optimize their algorithms on the wrong signals.

* **Drop noise** — stop test orders, internal traffic, or QA checkouts from polluting your analytics.
* **Exclude a segment** — keep B2B or wholesale orders out of a consumer-facing ad platform.
* **Isolate a case** — only send renewal orders, or only first orders, to a destination that cares about one of them.
* **Gate by value** — only send orders above a revenue threshold to a high-value audience.

### How a condition works

A trigger condition has three parts:

<table><thead><tr><th width="156.84375">Part</th><th width="339.8828125">Description</th><th>Example</th></tr></thead><tbody><tr><td><strong>Field</strong></td><td>The payload data you're testing for, in dot notation</td><td><code>email</code>, <code>app.name</code></td></tr><tr><td><strong>Operator</strong></td><td>How you're comparing it</td><td><code>equals</code>, <code>contains</code></td></tr><tr><td><strong>Value</strong></td><td>What you're comparing against</td><td><code>test@example.com</code></td></tr></tbody></table>

Read left to right, a condition is a sentence: *send this event only when `email`* *`contains`* *`@littledata.io`* .

Conditions live inside **condition groups**. An event can have one group or several, and the group is what decides how its conditions combine. See [Combine conditions](#combine-conditions) below.

{% hint style="info" %}
Not sure what a field is called? The [Tracking schema glossary](/event-editor/glossary.md) lists every field available in the schema.
{% endhint %}

### Add trigger conditions

{% stepper %}
{% step %}

#### Open the event editor

In the destination's [Event Editor](/event-editor/getting-started.md), open the **three-dot menu** on the event and select **Edit**.
{% endstep %}

{% step %}

#### Open the Event trigger section

This is where the event's conditions live.
{% endstep %}

{% step %}

#### Add a condition

Select a field, choose an operator, and enter a value.

<figure><img src="https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2FX5o14mtiDXnlqlXxEg1F%2Fimage.png?alt=media&amp;token=bd0abe91-f235-4c7b-9f5e-d28d194e1aa4" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Set the group to Any or All

Click **Add condition** for each extra condition you want in the same group, then use the **Any / All** toggle to say how they combine.
{% endstep %}

{% step %}

#### Add another group, if you need one

Click **Add condition group**. Groups are combined with AND, so reach for a second group when one part of your rule is an OR.
{% endstep %}

{% step %}

#### Save

Click **Save** to apply. The event will now only be sent when the conditions match.
{% endstep %}
{% endstepper %}

### Operators

For text fields:

| Operator         | Description                             |
| ---------------- | --------------------------------------- |
| `equals`         | Exact match                             |
| `does not equal` | Anything except an exact match          |
| `contains`       | Field includes the value as a substring |
| `starts with`    | Field begins with the value             |
| `ends with`      | Field ends with the value               |

Numeric fields support all of the above, plus:

| Operator                | Description              |
| ----------------------- | ------------------------ |
| `greater than`          | Strictly greater         |
| `greater than or equal` | Greater than or equal to |
| `less than`             | Strictly less            |
| `less than or equal`    | Less than or equal to    |

Boolean fields support only `equals` and `does not equal`.

### Combine conditions

One condition covers simple cases. For anything more specific, you control the logic at two levels: inside a group, and between groups.

**Inside a group**, the **Any / All** toggle decides how its conditions combine:

* **All of the following conditions are true**: every condition in the group must match. Use it to narrow.\
  Example: send the event only for subscription orders worth 100 or more.\
  `properties.total_price` `greater than or equal` `100` and `properties.tags` `contains` `subscription`
* **Any of the following conditions are true**: one match is enough. Use it to widen.\
  Example: send the event when the order is tagged either *wholesale* or *b2b*.\
  `properties.tags` `contains` `wholesale` or `properties.tags` `contains` `b2b`

**Between groups**, the logic is always AND. Every group has to pass before the event is sent, and the order of the groups makes no difference.

That split is what lets you write an OR inside an AND: put the either/or part in its own **Any** group, and the rules that must always hold in an **All** group.

#### Example: two groups

Send a purchase only when it's a customer's first order, it isn't a renewal, and it contains one of two products.

Group 1, set to **All**:

| Field                   | Operator             | Value       |
| ----------------------- | -------------------- | ----------- |
| `properties.order_type` | `does not equal`     | `RECURRING` |
| `customer.orders_count` | `less than or equal` | `1`         |

AND

Group 2, set to **Any**:

| Field           | Operator | Value  |
| --------------- | -------- | ------ |
| `products.name` | `equals` | `shoe` |
| `products.name` | `equals` | `cap`  |

A returning customer buying a shoe fails group 1. A first-time customer buying a hat fails group 2. Neither order is sent. A first-time customer buying a cap passes both, so the event is sent.

<figure><img src="https://3956158252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1QhTbrMraNWciQeDvu1b%2Fuploads%2F8XhX1erTUHU6COfxE69M%2Fimage.png?alt=media&amp;token=9c02c12a-6bb3-4209-8890-7d3b2754aec7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
With ALL logic, one condition that never matches stops the whole event. If an event goes quiet after an edit, that's the first thing to check.
{% endhint %}
