# How segments work

> What a segment is, what the Behavior, Profile filter, Facebook and Google scopes mean, how rules and filters combine, what Calculate Segment and Export Segment do, and some segments worth building first.

A **segment** is a named set of rules that picks profiles from everything Releva knows about your customers: tracked events, orders, subscriptions, message interactions and profile attributes. You manage segments under **Data Platform › Segments**. A segment stores only its rules; who is in it is worked out when it is used, so it follows your customers’ behaviour without you touching it.

## What uses a segment

* **Campaigns** and **workflows** send to the profiles in a segment.
* **Product blocks**, **banners** and **stories** show personalized content only to a segment.
* **Facebook product sets** and **segment syncs** push a segment to an ad platform. See [How segment syncs work](https://releva.ai/documentation/learn/sync-segments/how-segment-syncs-work/).
* **NPS** surveys and **funnels** are scoped to segments.
* **Audience Performance** under **Analytics › Customer Insights** reports the segments you star. See [Track a segment in Audience Performance](https://releva.ai/documentation/guides/segments/track-a-segment-in-audience-performance/).

Because of this, deleting a segment also deletes the campaigns, workflows, product blocks, banners and Facebook product sets that target it. The admin warns you before it does.

## Four scopes

Every segment has a **Scope**. Pick it before you add rules: switching scope clears the rules, and the scope is fixed once the segment is saved.

| Scope                  | Who evaluates the rules                                                                                                                                                                                                                                           | Typical use                                                                                                                                                             |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Behavior** (default) | Releva, from the events and profiles it has tracked. Rules describe actions over time: **Purchased**, **Added to cart**, **Viewed product**, **Clicked email**, **Subscribed**, and 70 more, plus one **Performed action** rule per custom event your shop sends. | Most segments: buyers, browsers, churn risks, subscribers. Only this scope can be counted, exported, synced to an ad platform or used in a Facebook product set.        |
| **Profile filter**     | Releva, in real time, on the profile that is on the page. Eleven rules such as **Has products in cart**, **Registered**, **Subscribed**, **Clicked product block** and **Profile Attributes**. No count is shown.                                                 | Product blocks and banners that must react to what the visitor has done in this session. Saving a rule change clears the page cache of the blocks that use the segment. |
| **Facebook**           | Meta, from **Audience Rules**, **Segment Lookalikes** or **Page Fans Lookalikes**. Saving creates the audience in the connected ad account.                                                                                                                       | Facebook Ads targeting. Needs a connected account under **Settings › Facebook & Whatsapp** and accepted Custom Audience terms.                                          |
| **Google**             | Google Ads, from **Audience Rules for Web Page Visitors** (URL contains, equals, starts with, ends with) or **Conversion Actions**. Saving creates the user list in the connected account.                                                                        | Google Ads targeting. Needs a connected account under **Settings › Google**.                                                                                            |

Facebook and Google segments need at least one rule before you can save, and their rules are read-only after the first save.

## Rules and filters

A Behavior or Profile filter segment is a list of **rules**. A profile is in the segment when it matches **all** of them: rules combine with AND. To express “either this or that”, add the rule **At least one of… (nested or)** and put the alternatives inside it.

Each rule has:

* **Mode**: the action itself (**Purchased**) or its negation (**Not Purchased**). The card on the list shows negated rules as **Not \<rule>**.
* **Filters** that narrow the action. Which filters exist depends on the rule. **Purchased** offers **Count**, **Time**, **Days ago**, **Hours ago**, **Cart total**, **Categories**, **City**, **Region**, **Country code**, **Product Id**, **Order Id**, the campaign and message it followed, and UTM parameters. A rule without filters matches the action at any time.
* Shop-specific extras: **Product custom field…**, profile custom fields and **Survey field…** appear when your shop has them.

**Days ago** takes two numbers: the older end of the period and the newer end, where **0** is today. **30** to **0** means the last 30 days; **60** to **30** means the month before that. **Count** works the same way: **1** to **1** means exactly once.

A segment with no rules at all means everyone.

## Counting, sampling and exporting

For a Behavior segment the form shows a counter under the rules:

* When you open a saved segment, Releva estimates it automatically. After any rule change the estimate is replaced by **Calculate Segment**, which you run when you want a fresh number.
* The result reads **\<n> Profiles** followed by how many of them can be reached by email, text message, push notification, Facebook and Google. Below it is a sample table with **Profile**, **Email**, **Phone number**, **Registered At**, **Subscribed At** and **Last Change At**.
* The count badge on the segment’s card comes from Releva’s scheduled segment run. **Calculate Segment** and **Save** do not change it.
* **Export Segment** schedules an export of the profiles in the segment and e-mails you a download link when it is ready. The export is named **Profiles in segment \<name> evaluated at \<date>** and is also listed under **Analytics › Exports**. Choose which custom fields to include when you start it. The file has one row per profile in the segment, anonymous visitors included. An anonymous visitor has no e-mail address or phone number, so its row has empty **Email\*** and **Phone number** columns.

Counting runs a query over your whole event history. If too many estimates run at once, the request is refused with **You have attempted to estimate too many segments at the same time. Please try again later!**; if the query fails, with **Failed to estimate segment. Please try again later!**. The form itself shows no message in either case: **Calculate Segment** simply comes back, and you can try again.

## Segments worth building first

These rule sets cover the usual lifecycle stages. Adjust the periods to your purchase cycle.

| Segment               | Rules                                                                                  | What to do with it                                                        |
| --------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| Interested visitors   | **Viewed product**; **Not Purchased**; **Not Subscribed**                              | A banner that asks for an e-mail address, or shows a first-order voucher. |
| Loyal visitors        | **Viewed product**; **Not Purchased**; **Subscribed**                                  | An e-mail with the week’s best offers to win the first purchase.          |
| First purchase        | **Purchased** with **Count** 1 to 1                                                    | A feedback survey with a voucher for the second order.                    |
| Recent buyers         | **Purchased** with **Days ago** 7 to 0                                                 | A review request, or a reminder for consumables.                          |
| Repeat buyers         | **Purchased** with **Count** 3 to 99 and **Days ago** 60 to 0                          | Upsell and bundle offers.                                                 |
| At risk               | **Purchased** with **Days ago** 180 to 30; **Not Purchased** with **Days ago** 30 to 0 | A reactivation e-mail with a personal offer.                              |
| Cart abandoners today | **Added to cart** with **Days ago** 1 to 0; **Not Purchased** with **Days ago** 1 to 0 | A triggered reminder workflow.                                            |

Start with one or two rules, calculate, then add filters and calculate again until the number looks right. Step by step: [Create a segment](https://releva.ai/documentation/guides/segments/create-a-segment/).

## Next steps

* [Create a segment](https://releva.ai/documentation/guides/segments/create-a-segment/): Build a Behavior segment and check who matches before you save.
* [Change a segment’s rules](https://releva.ai/documentation/guides/segments/change-a-segments-rules/): Add a filter to an existing segment and see what the change does to the campaigns that use it.
* [Track a segment in Audience Performance](https://releva.ai/documentation/guides/segments/track-a-segment-in-audience-performance/): Star a segment to follow its members, conversions and conversion value in Analytics.
* [How segment syncs work](https://releva.ai/documentation/learn/sync-segments/how-segment-syncs-work/): Learn how Releva pushes a segment to Facebook or Google Analytics and keeps it up to date.