Prerequisites
Before you can embed your widget, make sure:- Your widget has been saved in the widget editor
- Your widget status is set to Active
Getting the embed code
Open the Embed tab
In the widget editor, click the Embed tab. You’ll see your unique embed code snippet ready to copy.
Copy the embed code
Click the Copy button to copy the script tag to your clipboard. The embed code looks like this:Your actual widget ID is pre-filled in the code — you don’t need to replace anything manually.
Domain restrictions
Domain restrictions let you control exactly which websites are allowed to load your widget. This prevents unauthorised sites from embedding your widget and ensures it only appears where you intend.How to configure domain restrictions
- In the widget editor, navigate to the Embed tab.
- Toggle Domain Restrictions to enable them.
- Add each domain where you want the widget to appear (e.g.
www.example.com,docs.example.com).
How domain matching works
- Subdomains are matched automatically — adding
example.comallowswww.example.com,docs.example.com, and any other subdomain. - Each domain entry is matched against the hosting page’s URL.
- You can add
localhostwith a port number (e.g.localhost:3000) for local development and testing.
How the embed script works
When a visitor loads a page containing your embed code, the Compass script automatically:- Loads the widget UI — Renders the launch button and chat interface based on your widget configuration.
- Handles chat communication — Manages the real-time connection between the visitor and your Compass agent.
- Persists sessions — Stores session data in the visitor’s browser using
localStorage, so conversations continue seamlessly across page loads. - Captures attribution data — Records marketing parameters to help you understand where your visitors are coming from.
Session persistence
Visitor sessions are automatically persisted using the browser’slocalStorage. This means:
- Conversation history is maintained as visitors navigate between pages on your site.
- Returning visitors see their previous conversations when they reopen the widget.
- Sessions are scoped to the domain where the widget is embedded.
If a visitor clears their browser data or uses a private/incognito window, their session history will not be available.
Marketing attribution
The embed script automatically captures visitor attribution data, giving you insight into how visitors find your widget. The following parameters are tracked:| Parameter | Description |
|---|---|
| UTM parameters | utm_source, utm_medium, utm_campaign, utm_term, utm_content |
| Referrer URL | The page or site that referred the visitor to your website |
| Click IDs | gclid (Google Ads), msclkid (Microsoft Ads), fbclid (Meta/Facebook Ads) |
Attribution data is captured on the first page load and associated with the visitor’s session. No additional configuration is required — it works automatically.
Troubleshooting
The widget button doesn't appear on my website
The widget button doesn't appear on my website
The widget loads but chat doesn't work
The widget loads but chat doesn't work
- Verify that an agent is assigned to the widget and the agent’s status is Active.
- Check your browser’s network tab for failed API requests.
- Ensure your website doesn’t have a Content Security Policy (CSP) blocking connections to
app.roserx.health.
The widget doesn't appear on localhost
The widget doesn't appear on localhost
- Make sure domain restrictions include your local development address (e.g.
localhost:3000). - If you’re using a framework with hot reloading, try a full page refresh.

