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.com
will 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',
}
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 3 months ago
What’s Next