Hide Web Widget | Community
Skip to main content

Hide Web Widget

  • September 5, 2019
  • 3 replies
  • 0 views

Hi,

After moving to the new ZenDesk integrate chat experience, how do we hide the web widget, while being able to open the chat window only from our own code?

Currently, I can do: zE('webWidget', 'hide'), and then when I want to open, I can do: zE("webWidget", "show"); zE("webWidget", "open");, but when the user minimizes the window, the widget is again visible which we don't want.

In the previous version we were able to handle the launcher widget separately from the chat window. How do we do that in the current version?

This topic has been closed for replies.

3 replies

  • September 6, 2019

Hi Lambo.

Would you be comfortable exposing the full piece of code regarding the Widget, then I can take a look.

#helpsome regards,
Thomas de Silva

Zendesk Consultant @ helphouse.io


  • Author
  • September 6, 2019

Hi Thomas,
That's pretty much the full piece of code:
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=XXXXX"></script>
<script type="text/javascript">zE('webWidget', 'hide');</script>

Then elsewhere, I have other functionality to open the chat window where I call:
zE("webWidget", "open");


  • September 12, 2019

Hey Lambo,

This is indeed possible. You can use the command "on close". Below is my explanation on how I did it.

1. For some reason, the following code didn't work without actually c/p the Widget inclusion script in the header. So do this.

2. Hide the widget from start, as you already do:
zE('webWidget', 'hide');

3. Implement button to open the widget in the state you want, like you already do:
<button onclick="zE('webWidget', 'show')">Show Web Widget</button>

4. The functionality of closing the widget completely once the end-user minimizes it, do the following: zE('webWidget:on', 'close', function() {
    zE('webWidget', 'hide');
}); 

#helpsome regards,
Simon Blouner
Zendesk Consultant @ helphouse.io