> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.chrisp.chat/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to automatically push segments

__Learn how to set visitor segments from your website with the Crisp JavaScript SDK.__

Segments help you classify visitors and conversations based on your own product or website logic. Once set, they can be used for routing, filters, campaigns, reporting, and team workflows.

---

# Set one or more visitor segments

Use the ****Crisp JavaScript SDK**** after the Crisp chatbox snippet is available on the page.

```
// Replace these values with your own internal segments.$crisp.push(["set", "session:segments", [["registered_users", "lead"]]]);
```

|| This example sets two segments. You can set only one segment, or replace both with the lifecycle, plan, role, or product segments that matter to your team.

#### Overwrite existing session segments

By default, the call adds the provided segments to the current session. If you want to replace the current session segments instead, pass `` `true` `` as the second argument.

```
$crisp.push(["set", "session:segments", [["customer", "vip"], true]]);
```

---

# Use segments after they are set

Segments become useful once they are part of your team workflow.

__Common ways to use segments in Crisp:__

* ****Inbox filters**** → focus on conversations from specific groups, such as leads or VIP customers
* ****Routing rules**** → send certain conversations to the right team
* ****Advanced contact filters**** → build lists for follow-up or campaigns
* ****Campaign targeting**** → send messages to users who match a specific segment

---

# Go further

If you need to store richer information such as `` `plan` ``, `` `account_id` ``, or `` `lifetime_value` ``, use ****custom data**** instead of segments. Segments are best for labels; custom data is better for key/value context.

| Want to know more about the `` `$crisp` `` interface? Read [How do I use the $crisp chatbox SDK?](/en/article/how-do-i-use-the-crisp-chatbox-sdk-1lp254r/).