1. Home
  2. Docs
  3. Installation
  4. Hide chat on selected pages

Hide chat on selected pages

If there are some pages on your website where you don’t want to include Dialogity chat, you can do it by setting a JavaScript variable before the chat is loaded, for example, in the code snippet which is loading the live chat.

<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
  window._chb_mainColor = '#16519F';
  window._chb_uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  window._chb_lang_code = 'HUN';
  if (window.location.href.includes('url_part_where_hide')) {
    window._chb_disable = true;
  }
</script>
<script src="//js.dialogity.com/main.js" async="true"></script>

The important part here is the line ‘window._chb_disable = true;’. On pages where this variable is set, the chat won’t be displayed.

Hiding welcome message only

Similarly, there can be pages where for some reason, you want to keep the chat functionality, but you don’t want to display the welcome message. To get this result just include ‘window._chb_nowelcome = true;’ instead of ‘window._chb_disable = true;’ on the selected pages.