Session Storage Mechanism
Session Storage Mechanism
IMPORTANT:
Before setting this configuration, please consult with a member of the frontend team to ensure it aligns with your project requirements.
The chat widget uses a session ID to communicate with the flow engine and to persist conversations across different tabs and page refreshes. By default, this session ID is stored in the browser's localStorage.
Data stored in localStorage is only available on the domain that created it. For example:
- If there is a widget session on
somesite.com, the session will only persist on that domain. - If the widget is embedded on
help.somesite.com, a session ID created onsomesite.comwill not be available there.
Cross-Subdomain Persistence
You may want to persist the chat session across multiple subdomains. To enable this, the session ID can be stored in a cookie that is shared across subdomains.
You can enable this functionality using the following configuration:
sessionStorageMechanism: {
mechanism: 'cookie',
domain: 'somesite.com',
}The session cookie is always set with path=/, so it is available on every page of the site — not only the page where the conversation started. Combined with domain, this also makes the session available on subdomains (for example help.somesite.com), provided the widget is installed on those hosts as well.
Configuration Properties:
- mechanism: Defines how the session ID is stored. It can be either:
- localstorage (default)
- cookie (enables cross-subdomain persistence)
- domain: Specifies the domain of the site (e.g., 'somesite.com'). This is required when the mechanism is set to
cookie. Ensure the domain is provided without https:// and without trailing slashes.
Updated 6 days ago
