> ## Documentation Index
> Fetch the complete documentation index at: https://help.lobyco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a segment

> Pick out the customers you want to reach by combining rules, then save the segment to reuse in any campaign.

A segment picks out customers by rules, for example everyone who spent more than 500 in the last 30 days. This page takes you through building one on the **Segments** page and saving it, so you can use it in any campaign.

## Start a new segment

1. Go to **Segmentation** → **Segment templates**. The page that opens is called **Segments**.
2. Select **New segment**.

The form has two tabs, **Add Segment details** and **Segment attributes**.

## Fill in the details

| Field | What it does |
| - | - |
| **Template name** | Names the segment. Pick a name a colleague would recognise, for example *Spent 500+ in the last 30 days*. You look for this name when you add the segment to a campaign. |
| **Description** | Optional. Says what the segment is for. |
| **Permissions** | Sets who can see and change the segment. **Public** is everyone, **Restricted** is people in your department, and **Private** is only you. It starts as **Public**. |

## Add your rules

Open **Segment attributes**. The attributes are on the left, in categories. The **Segment builder** is on the right.

1. Find an attribute. Open its category, or type its name in **Search for attributes** at the bottom of the list.
2. Double-click the attribute, or drag it into the builder. It becomes a rule.
3. Pick an operator, such as **Greater than** or **Between**, and fill in the value.

A segment with no rules includes every customer. [Segment attributes](https://help.lobyco.com/business-documentation/audiences-and-data/segment-attributes.md) lists the attributes, and which operators each kind takes.

Some rules need a little more:

* A date rule with **Between** lets you choose **Fixed** or **Float**. **Fixed** uses the dates you pick. **Float** is a rolling window, such as the last 30 days, and moves forward every time the segment runs. Set it with the slider, or type the number of days ago in **From** and **to**.
* **Product** opens a **Product** picker. Search or browse for the products, tick them, then select **Add criteria**. To pick single products rather than a whole group, choose them in the column furthest to the right.
* Purchase attributes, such as **Amount spent** or **Receipt count**, look at the last 90 days unless you add a **Purchase date** rule. The builder reminds you under the rule.

For example, to find customers who spent more than 500 in the last 30 days, add two rules:

| Rule | Operator | Value |
| - | - | - |
| **Amount spent** | **Greater than** | 500 |
| **Purchase date** | **Between**, with **Float** | **From** 30, **to** 0 |

![The Segment attributes tab of a saved segment named Spent 500+ in the last 30 days. On the left, the SEGMENT ATTRIBUTES list has the Purchase category open, showing Amount spent, Amount spent (single receipt) and Items bought. On the right, the Segment builder reads The segment includes customers who … and holds two rules joined by an AND badge: Amount spent, Greater than, 500, and Purchase date, Between, with Float selected, from 30 to 0 days ago. Each rule ends with the note Data from today may be incomplete.](https://mintcdn.com/lobyco-4c9fb3ad/rG971_5ZfS49bcjM/images/audiences-01-two-rules-joined-by-and.png?fit=max\&auto=format\&n=rG971_5ZfS49bcjM\&q=85\&s=c8be1ce22b6c0532ad1a1b3a0fbbf71b)

*Two rules joined by AND, with Purchase open in the attribute list*

## Join the rules with AND, OR or AND NOT

New rules join with **AND**. To change how two rules join, select the badge between them and pick another.

| Badge | Customers must |
| - | - |
| **AND** | Match both rules. |
| **OR** | Match at least one of the rules. |
| **AND NOT** | Match the rule before it, and not the rule after it. |

When you change the badge between two rules in a longer list, those two rules move into a group of their own. The group works like one rule, so you can build logic such as *spent over 500 AND (shops in store A OR shops in store B)*.

* To lock a group, select the lock icon beside it. A locked group stays as it is when you change the badges around it. Select the icon again to unlock it.
* To move a rule, drag it by its handle to another place or into a group.
* To delete a rule, select it, then select **Delete criteria(s)**. Hold Ctrl while you select to delete several at once.

![The Segment builder of a segment named Big spenders who shop often or buy a lot, with three rules. Amount spent, Greater than, 500, is joined by an AND badge to a group, marked by a bracket down its left side and an open lock icon at its top. Inside the group, Receipt count, Greater than, 5, and Items bought, Greater than, 20, are joined by an OR badge. Each rule ends with the note If no purchase date attribute is added the default date range on this attribute is last 90 days.](https://mintcdn.com/lobyco-4c9fb3ad/rG971_5ZfS49bcjM/images/audiences-02-group-of-rules-with-lock.png?fit=max\&auto=format\&n=rG971_5ZfS49bcjM\&q=85\&s=69ca1222e41aec150a1986abf1a4c981)

*A group of two rules joined by OR, with its lock icon*

## Check what the segment does

Below the builder, three controls help you check the segment before you save it.

* **Segment summary** (BETA) explains in plain words which customers the segment includes. It starts with a suggested name for the segment. It's written by AI, in English, so check it against your rules before you rely on it. The summary updates when you change a rule, and it isn't saved.
* **Show SQL query** shows the database query your rules turn into.
* **Show limitation config** caps how many customers the segment passes on. Use the slider, from 1k to 500k, or type a number. **Inf** means no cap. The cap doesn't choose which customers to keep, so don't use it to pick your top spenders. It's useful when you only need part of a large segment, because the segment then runs faster.

## Save the segment

How you save depends on where you built the segment.

> [tab] On the Segments page
>
> 1. Check that both tabs show a tick. A tab's number turns red while something on it is still missing. **Save** stays greyed out while the segment has no **Template name** or a rule has no value.
> 2. Select **Save**.
> 3. You go back to the **Segments** list, and the new segment is in it. Its **Size** stays empty until the segment has run in a campaign.
>
> To leave without saving, select **Cancel**.

> [tab] In a Member segment block
>
> You can also build a segment inside a campaign's **Member segment** block, with the same builder. To keep it for other campaigns, save it as a template.
>
> 1. Open the arrow beside **Save**, then select **Save as template**.
> 2. In **Provide template name**, type a **Template name**, then select **Save**.
> 3. The block is now linked to the new template. Select **Save** to save the block too.
>
> The segment now shows on the **Segments** list. **Save as template** isn't offered while the block is already linked to a template.

## Use the segment in a campaign

In a campaign, add a **Member segment** block and open it. Choose **From Template**, then pick your segment by its name. [Block reference](https://help.lobyco.com/business-documentation/campaigns/orchestration-canvas/block-reference.md#member-segment) covers the block step by step.

A saved segment doesn't have to pick out everyone you want to reach. You can save a part, such as women aged 18 to 50, and combine it with other segments on the canvas.

## Troubleshooting

> [accordion] What does 'Data from today may be incomplete' mean?
>
> Today's purchases are still coming in, so a rule that looks at today may miss some of them. [Why does my segment show a missing data warning?](https://help.lobyco.com/business-documentation/audiences-and-data/why-does-my-segment-show-a-missing-data-warning.md) explains this and the other warnings.

> [accordion] Why does my segment with two Consent rules find nobody?
>
> Two **Consent** rules joined with **AND** in the same segment return no customers. Put each one in a segment of its own instead, then join the two segments on the canvas with an **Intersect** block. [Block reference](https://help.lobyco.com/business-documentation/campaigns/orchestration-canvas/block-reference.md#intersect) shows how.

## Related

* [Segment attributes](https://help.lobyco.com/business-documentation/audiences-and-data/segment-attributes.md) — every attribute category, and which operators each kind of attribute takes.
* [Manage saved segments](https://help.lobyco.com/business-documentation/audiences-and-data/manage-saved-segments.md) — find, copy and remove the segments you've saved.
* [Reuse a saved segment](https://help.lobyco.com/business-documentation/use-cases/reuse-a-saved-segment-across-campaigns.md) — a worked example, from saving a segment to using it in a campaign.
* [Find customers by what they buy](https://help.lobyco.com/business-documentation/use-cases/find-customers-by-what-they-buy.md) — one of several Use Cases that build a segment for a real campaign.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.