How to persist a single chatbox conversation across difference devices, browers and apps
Learn how to restore the same Crisp chat session for authenticated users with a secure token.
Session continuity lets logged-in users recover the same Crisp conversation even when they change browser, switch device, or clear cookies. It works by associating each authenticated user with a private token generated by your own backend.
When to use session continuity
Use session continuity when your application has a reliable internal identifier for the visitor and you want support history to stay attached to that authenticated account.
Session continuity is useful when:
- Users must log in before contacting support → the same account should keep the same conversation context
- Customers use several devices → support history should follow the authenticated user
- Cookies may be cleared → the session can still be restored from your own secure token
Set the token before loading Crisp
Sessions are associated with tokens through the CRISP_TOKEN_ID variable. This value must be set before the Crisp chatbox script loads.
<script type="text/javascript">
$crisp = [];
CRISP_TOKEN_ID = "USER_SECURE_TOKEN_FROM_YOUR_BACKEND";
CRISP_WEBSITE_ID = "YOUR_WEBSITE_ID";
(function(){
d = document;
s = d.createElement("script");
s.src = "//client.crisp.chat/l.js";
s.async = 1;
d.getElementsByTagName("head")[0].appendChild(s);
})();
</script>
Generate the token on your backend, store it in your database, and associate it with one user only.
Handle login and logout safely
If the token becomes available after the chatbox is already loaded, reset the session after setting the new token so Crisp can bind the session again.
When users log out, clear the token and reset the local Crisp session.
function userLogout() {
CRISP_TOKEN_ID = null;
$crisp.push(["do", "session:reset"]);
}
This does not delete the remote Crisp conversation. It only unbinds the current browser from that conversation, so the session can be restored later when the same authenticated user logs back in with the same token.
Merge anonymous sessions when needed
If visitors can start chatting before logging in, Crisp can switch to the token session after login. When you want to merge the anonymous session into the token session, enable session_merge in CRISP_RUNTIME_CONFIG before loading the chatbox.
<script type="text/javascript">
CRISP_RUNTIME_CONFIG = {
session_merge: true
};
</script>
Make sure you do not overwrite another CRISP_RUNTIME_CONFIG object elsewhere on the page.
Developer documentation
Read the Session Continuity documentation for the full implementation details and security recommendations.
If you embed Crisp in a single-page app with crisp-sdk-web, also review the NPM Package documentation for tokenId usage and logout cleanup.
Updated on: 03/05/2026
Thank you!