Search code examples
javascriptzendesk

Hiding Zendesk chat button opens chat window. Any fix?


I have a url I would like to hide the Zendesk chat button on. Looking at their documentation I see that I need to use the hideAll() function. To that end, I have created:

$zopim(function () {
   if (currentPath === '/mypage') {
      $zopim.livechat.button.hide();
   }
});

However, this does not hide the button - instead it opens the chat window on page load.

Would anyone know what I could do to simply hide the Zen Desk chat button?

(PS the currentPath works, I just haven't included the function in here to save room. I can console.log within the if statement fine.)


Solution

  • The hideAll() function did work, I just had to apply it to everything, eg:

    $zopim.livechat.hideAll();
    

    Not:

    $zopim.livechat.button.hideAll();