> For the complete documentation index, see [llms.txt](https://doc.customfit.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.customfit.ai/segments/segment-rules.md).

# Segment Rules

Once you have created a segment the next step is to add the rules or target individual visitor. If the visitor customer\_id is known and if you want to include or exclude them from the segment then click on "Add user targets" button.

![](/files/-MXqwH5pSZaWjzpa_3A8)

Enter the visitor customer\_id whom you want to include or exclude from the segment.

![](/files/-MXqx11cYeaV_dXVX9iZ)

Once all the details are filled you can add the rules for the segment

![](/files/-MXqy3Ib5htd6DMwxRis)

## Targeting visitors based on rules

To add the rules click on "Add rules"

![](/files/-MZCskFq1D4vBMGqShHJ)

Each rule has three parts:  an attribute, an operator and the value/s. For example, if you want to target a group of visitors from India then you can have a rule as Country  IS\_ONE\_OF  India

![](/files/-MZCtOLqK-_CF8nUmFVg)

A rule can have multiple conditions where the visitors need to satisfy all the conditions. For example, if you want to target a group of visitors from India and the device type is Desktop then you can have a rule as Country  IS\_ONE\_OF  INDIA and Device Type IS\_ONE\_OF Desktop

![](/files/-MZCwjLNpBRBCo576e5y)

Finally click on Save Changes button in order to apply the changes to the visitor segment

![](/files/-MZIttELeIJW1hjrtL7A)

Follow the below steps, which makes you to write the rules easier:

* To copy a rule, click on the copy icon above the rule&#x20;

![](/files/-MZCyKHNRfKUDvtWNFcl)

* To delete a rule, click on the delete icon above the rule&#x20;

![](/files/-MZCzcXBMI_w0LyDCCV9)

* To add a new rule click on the Add  button

![](/files/-MZD-NNWEIEGWjkpBYem)

* To copy a condition, click on the copy icon beside the condition&#x20;

![](/files/-MZD-x_cl1bz2PIBCR3Q)

* To delete a condition, click on the delete icon beside the condition&#x20;

![](/files/-MZD04KCa2TriMhwf6xa)

* To add a new condition click on the "+" icon which is present beside the last condition

![](/files/-MZD0_J2L0Sz0wQNnChT)

* Once the segment has been created, you can use that segment in the experience rule engine to target a particular group of visitors.

![](/files/-MZIpUMxt2IE9HkvLxpH)

​


---

# 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, and the optional `goal` query parameter:

```
GET https://doc.customfit.ai/segments/segment-rules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
