Widget Interaction Tracking¶
Overview¶
Rose stores interaction data in the browser that client websites can read to determine if a user filling a form has previously interacted with Rose. This enables attribution of form submissions to Rose conversations.
Storage¶
Rose stores data in two locations:
Cookies¶
| Cookie Name | Description |
|---|---|
rose_last_active_session |
Session ID of the last conversation where user sent a message |
rose_last_active_session_date |
Unix timestamp (milliseconds) when session was last active |
rose_client_id |
Stable visitor ID (PostHog distinct_id) |
Cookie Properties:
- Expiry: 1 year
- Secure: HTTPS only
- SameSite: Lax
- Cross-subdomain: Cookies are set on the root domain (e.g.,
.example.com) so they work across subdomains
localStorage¶
Detailed analytics stored under a single rose key:
localStorage.rose = {
version: 1,
widget: {
analytics: {
counters: {
widgetImpressions: number,
messagesSent: number,
ctaClicks: number,
formsSubmitted: number,
loginClicks: number
},
lastSessionId: string | null,
lastActiveSessionId: string | null,
lastActiveSessionDate: number | null,
clientId: string | null
}
}
}
Fields:
| Field | Type | Description |
|---|---|---|
counters.widgetImpressions |
number | Number of times widget was displayed |
counters.messagesSent |
number | Number of messages user sent to Rose |
counters.ctaClicks |
number | Number of CTA button clicks |
counters.formsSubmitted |
number | Forms submitted after Rose interaction |
counters.loginClicks |
number | Login button clicks after Rose interaction |
lastSessionId |
string | null | Most recent session ID (any interaction) |
lastActiveSessionId |
string | null | Session ID where user last sent a message |
lastActiveSessionDate |
number | null | Unix timestamp (ms) of last message sent |
clientId |
string | null | Stable visitor ID (PostHog distinct_id) |
sessionStorage¶
Current chat state stored per browser tab:
Key: inboundx_chat_state_{siteName}
Contains: conversationPairs, isExpanded, sessionId, siteName
Reading Rose Data¶
From Cookies¶
function getRoseCookies() {
const cookies = document.cookie.split(';').reduce((acc, cookie) => {
const [name, value] = cookie.trim().split('=');
acc[name] = decodeURIComponent(value);
return acc;
}, {});
return {
sessionId: cookies['rose_last_active_session'] || null,
sessionDate: cookies['rose_last_active_session_date']
? parseInt(cookies['rose_last_active_session_date'], 10)
: null,
clientId: cookies['rose_client_id'] || null
};
}
From localStorage¶
function getRoseLocalStorage() {
const roseData = localStorage.getItem('rose');
if (!roseData) return null;
const data = JSON.parse(roseData);
return data?.widget?.analytics || null;
}
Key Identifiers¶
| Identifier | Description | Use Case |
|---|---|---|
sessionId |
Session ID where user last sent a message | Link form submission to conversation |
clientId |
Stable visitor ID (PostHog distinct_id) | Track user across sessions |
sessionDate |
Timestamp of last activity | Measure time between chat and form |