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"]]]);
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.
$crisp interface? Read How do I use the $crisp chatbox SDK?.Updated on: 03/05/2026
Thank you!