Hide widget completely | Community
Skip to main content

Hide widget completely

  • September 18, 2017
  • 3 replies
  • 0 views

Hello. I have seen some related posts on this topic but because I am not a coder I have not found the exact answer I'm looking for.

Surprisingly, ZenDesk Chat does not offer a function to hide the widget on demand. You would think the "Invisible" setting would do this, but apparently it does not.

I know that there is javascript that can be added to hide the widget when certain situations exist. The scenario that I would like the widget to be hidden is when the number of Agents = 0.

Is there anyone that can help me with the exact code I would need for this?

Thanks.

This topic has been closed for replies.

3 replies

  • September 20, 2017

Hi Gene

There are different ways to do with JavaScript API, the simplest code you can have (assuming you are using Zendesk/Zopim Chat, not Zendesk Chat Web SDK).

You can copy paste following in JS tab of Theme editor in Guide Admin:

$(document).ready(function() {
        $zopim.livechat.button.setHideWhenOffline(true);
});

If you want to make above code work on your website, you need to make sure you have jquery loaded (most modern websites have), and copy paste it anywhere with script tag:

<script>

$(document).ready(function() {
        $zopim.livechat.button.setHideWhenOffline(true);
});

</script>

Please let me know if this worked for you.

Cheers

Abdul Qabiz
diziana  •  twitter  •  linkedin  •  blog

Team Diziana


  • Author
  • September 25, 2017

Hi Abdul. This sounds like what I am looking for. Can you provide me a little more guidance on where the first code goes. I am using Zopim Chat, but I don't know where the Theme editor in Guide Admin is. Thanks.


Trapta
  • September 26, 2017

Hi @Gene DiPaula,

It is available in the HC navigation bar.


Thanks

Team Diziana