Chatbox SDKs | Web Chat SDK
Give Feedback

Cookie Policies

Updated on September 21, 2021

Depending on your internal security and privacy policies related to cookies, you may want to control how the Crisp chatbox uses cookies.

Restrict Cookie to Domain

By default, Crisp shares its chatbox domain on your primary domain, and all its sub-domains. This lets you share the same chatbox session across all your website & apps. In some specific use cases, you may want to restrict the cookie to a given domain.

You can do so using the Crisp Cookie Domain chatbox variable. The domain name is set as a string, and points to your base domain by default.

For instance, if your website domain is www.acme.com, the base domain would be acme.com, and the cookie would be shared with eg. app.acme.com and help.acme.com and others. You may want to avoid that, and restrict the cookie to eg. app.acme.com only.

Chatbox cookie auto-detected base domain can be adjusted, using the CRISP_COOKIE_DOMAIN variable.

You can use the following Crisp chatbox code (fill CRISP_COOKIE_DOMAIN with your domain):

<script type="text/javascript">
  $crisp = [];
  CRISP_COOKIE_DOMAIN = 'app.acme.com';  // Domain to restrict the cookie to
  CRISP_WEBSITE_ID = 'MyWebsiteID';
  (function(){d=document;s=d.createElement('script');s.src='//client.crisp.chat/l.js';s.async=1;d.getElementsByTagName('head')[0].appendChild(s);})();
</script>
You need to ensure the altered cookie domain variable is set on every page that has the chatbox included on. If a visitor accesses a page where you're not setting this variable, the default auto-domain cookie will be used, and thus the user session will be different on those pages.

Change Cookie Expiration Date

If you are concerned about the privacy of your users, and want the chatbox session cookie to expire sooner than default (6 months), you can easily alter this expire time from your JavaScript code.

You can do so using the Crisp Cookie Expire chatbox variable. The expire time is set in seconds. The cookie expiration time is prolonged every time a visitor with an existing cookie access your website.

Chatbox cookie default expire date can be adjusted, using the CRISP_COOKIE_EXPIRE variable.

You can use the following Crisp chatbox code (fill CRISP_COOKIE_EXPIRE with your adjusted expire time in seconds):

<script type="text/javascript">
  $crisp = [];
  CRISP_COOKIE_EXPIRE = 3600;  // Expire time in seconds, here: 1 hour = 3600 seconds
  CRISP_WEBSITE_ID = 'MyWebsiteID';
  (function(){d=document;s=d.createElement('script');s.src='//client.crisp.chat/l.js';s.async=1;d.getElementsByTagName('head')[0].appendChild(s);})();
</script>
Make sure to enter an expiration time in seconds. For instance, to expire the cookie after 1 hour, you'd enter 3600.
You need to ensure the altered cookie expire time variable is set on every page that has the chatbox included on. If a visitor accesses a page where you're not setting this variable, their cookie expiration time will be updated to the default again (6 months) when the chatbox will launch.