# Segment-2: Based on what customer did in a event

### Segment Definition:

*<mark style="color:green;">Customers who purchased product 'x' OR 'y' in May 2023.</mark>*

Let's breakdown this into the different filters:

1. Filter-1: Who performed the event: Order Created
2. Filter-2: Number of times the event was performed: Once or more
3. Filter-3: When the event was performed: In the month of May
4. Filter-4: Who bought product 'x' OR 'y'

\
Setting up the first three filters is what we learned in the previous example. This is how we can do it.

**Step-1: Setup the first three filters**

All customers who did `Order Created` where `total`  `is greater than or equal to` `1`  `in date range`  `May 1, 2023 - May 31, 2023`.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2Fy1f0mI22VrhTu3UOdX3w%2FScreenshot%202023-07-05%20at%204.16.00%20PM.png?alt=media&#x26;token=6bcbc1cf-6567-4682-90be-0566fe557b62" alt=""><figcaption></figcaption></figure>

**Step-2: Add product filter**

Using the filter icon to the right of the first rule, choose `Products`

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2F6D8hscodtqWwh7Imrvsf%2FScreenshot%202023-07-05%20at%204.16.15%20PM.png?alt=media&#x26;token=40e0b4d5-db0a-4e9e-8dd5-67487af5796d" alt=""><figcaption></figcaption></figure>

**Step-3: Specify the products 'x' and 'y'**

Add the *Product IDs* corresponding to product x and product y.&#x20;

This will filter all those purchase events where one of the purchased products was in the list of products IDs specified. These are comma separated values.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2FW37FdbSDMllQvLHmagRj%2FScreenshot%202023-07-05%20at%204.20.24%20PM.png?alt=media&#x26;token=f1279f92-2abe-4159-9c8c-d45390841b6b" alt=""><figcaption></figcaption></figure>

Give a name to your segment & save it. We are done!


---

# Agent Instructions: 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://limechatai.gitbook.io/limechat-product-guide/whatsapp-marketing/segments/creating-a-segment/segment-2-based-on-what-customer-did-in-a-event.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.
