> For the complete documentation index, see [llms.txt](https://docs.amply.tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amply.tools/concepts/targeting-and-audiences.md).

# Targeting and audiences

How Amply decides who sees what. A campaign reaches a user only when that user matches the campaign's conditions. This page explains the vocabulary: rules, operators, audiences.

## Rules are built from conditions

A rule is a list of conditions you combine in the rule builder. Each condition compares one attribute against one value using one operator.

Plain example:

> Users whose country is France AND whose `subscription_status` equals `premium` AND who installed the app in the last 30 days.

That is three conditions joined with AND. Each condition follows the same shape:

```
<attribute>           <operator>          <value>
country               equals              France
subscription_status   equals              premium
install date          is less than        30 days ago
```

You build this in the dashboard's rule builder by adding conditions one at a time. Conditions are joined with AND — every condition must pass for a user to match. Within a single condition, list-style operators give you an internal OR — "country is one of France, Germany, Italy" matches a user in any of the three.

## Attributes you can target on

Attributes are grouped by where they come from. See [User attributes](/concepts/user-attributes.md) for the full picture; here is what you can use in targeting conditions today:

* **Country** — the device's country.
* **OS version** — the device OS version (for example, iOS 17).
* **App version** — the current app version installed on the device.
* **App install version** — the version of the app at install time (useful for "only users who installed after v3.0").
* **Application** — which app in your project (include or exclude a specific app).
* **Install date** — when the user first installed the app. Works as an absolute date ("installed after 2026-01-01") or a relative one ("installed in the last 7 days").
* **Custom properties** — values you set on the user from your app code (plan tier, premium status, internal user type).

For the full list and when to use which, see [User attributes](/concepts/user-attributes.md).

## Operators

The operator set changes slightly by attribute type, but the vocabulary is small.

**Numeric and version comparisons:**

| Operator         | Meaning                  |
| ---------------- | ------------------------ |
| equals           | exactly equal            |
| not equal        | anything but this value  |
| greater than     | strictly greater         |
| less than        | strictly less            |
| greater or equal | greater than or the same |
| less or equal    | less than or the same    |

**Existence checks:**

| Operator   | Meaning                                 |
| ---------- | --------------------------------------- |
| is set     | the user has a value for this attribute |
| is not set | the user has no value                   |

**List membership (for country, application):**

| Operator | Meaning                                        |
| -------- | ---------------------------------------------- |
| include  | match when the user's value is in the list     |
| exclude  | match when the user's value is NOT in the list |

**Dates:**

Dates support absolute ("on or after 2026-01-01") and relative ("in the last 30 days") forms.

## Audience — the result of a rule

An audience is the set of users who currently match a rule. It is not a stored list. It is evaluated on-device every time a campaign is considered, using the latest attributes. A user who was in an audience yesterday can drop out today (for example, the user updated to a new app version, or changed country on vacation).

This matters: audiences are live. You do not "refresh" or "rebuild" them. A campaign that says "users in France on app version ≥ 5.0.0" will immediately pick up a French user the moment they upgrade.

## Targeting on past behavior

To gate on what users did before, track the event when it happens and **also** set a custom property on the user. The rule builder targets on the property; the event is the trigger that lets your code set the property.

> When a user completes onboarding, fire `OnboardingCompleted` and `setCustomProperty("has_onboarded", true)`. A campaign for "users who have NOT yet finished onboarding" then targets `has_onboarded is not set` (or `= false`).

The result is a rich audience composed of attribute and property conditions, all joined with AND. See [Campaign delivery](/concepts/campaign-delivery.md) for how triggers then decide when the campaign actually fires for those users.

## Targeting vs. triggering

These are often confused.

* **Targeting** decides who is eligible. "Is this user a match for this campaign?"
* **Triggering** decides when the eligible user sees it. "Has the right thing just happened?"

A user can be targeted by ten campaigns but only one triggers on any given event. See [Scenarios and campaigns](/concepts/scenarios-and-campaigns.md) and [Campaign delivery](/concepts/campaign-delivery.md) for how the two layers interact.

## Practical examples

* **"France or Germany, premium users"** — country IN \[France, Germany] AND custom property `plan = "premium"`.
* **"New users on the latest app version"** — install date in the last 7 days AND app version >= 3.4.0.
* **"Lapsing premium users"** — custom property `plan = "premium"` AND custom property `trial_ends_at` is within the next 3 days.
* **"Users who never finished onboarding"** — custom property `has_onboarded` is not set, or equals `false`.

## Related

* [User attributes](/concepts/user-attributes.md) — the attributes you can build conditions from
* [Sessions and events](/concepts/sessions-and-events.md) — where event-based conditions come from
* [Campaign delivery](/concepts/campaign-delivery.md) — how triggering combines with targeting
* [Targeting an audience](/user-guide/targeting-an-audience.md) — step-by-step in the dashboard
* [User attributes (dev)](/developer-guide/user-attributes.md) — setting custom properties from app code


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.amply.tools/concepts/targeting-and-audiences.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
