Recent searches


No recent searches

How do I hide live chat on certain pages of my website, but keep it on others?



image avatar

Elissa Tikalsky

Zendesk Digital Resources Team

Edited Jan 22, 2024


-3

6

6 comments

Is there a way to have the code on all pages but only show on certain pages so that the chat resumes if a user goes from a page with the chat widget to a page without the chat widget so we don't get cut off? Thanks!

0


image avatar

Erica Girges

Zendesk Developer Advocacy

Hi Tom! 
 
Thanks for posting your question to the Community. You could use on chat:unreadMessages to listen for chat notifications coupled with window.location.pathname to track which page the user is on then toggle hide/show for the chat widget based on your needs. Here are the links to the how to hide/show the chat widget.
 
Another solution, you could just use z-index on the chat widget to move it from the front or back of the page. You'll still want to track chat notifications and location as well though to determine when to change the z-index value.
 
Hope this helps!
 
Erica

0


Is there a way to suppress the widget one one particular form in the help center? For example, I want to suppress the widget on https://helpcenter.mycompany.com/hc/en-us/requests/new?ticket_form_id=1111111111, but not on https://helpcenter.mycompany.com/hc/en-us/requests/new?ticket_form_id=2222222, etc.

Would some sort of IF/THEN or CASE in the new_request_page.hbs do it?

 

0


image avatar

Mike DR

Zendesk Customer Care

Hi Carmelo!
 
You're correct, it would require custom coding to create the IF/THEN statement to hide the widget for particular forms. Here's the code for hiding the web widget:
 
zE('messenger', 'hide');
 
Article for reference: Core messaging Web Widget API

0


Hi, I wanted to confirm something regarding the messenger and how it acts with hide/show.
In our app at a certain breakpoint and below we hide the messager, for smaller devices. When this happens they can open zendesk messenger again if they click on our support button from a dropdown menu, we did something like this to create that experience:
zE('messenger', 'hide');
zE('messenger:on', 'open', () => {
  zE('messenger', 'show');
});
zE('messenger:on', 'close', () => {
  zE('messenger', 'hide');
});

However, once they close Zendesk messager we want the messenger to be hidden again, but we briefly see the zendesk bubble before it gets hidden. Is this the expected behavior of the messenger? e.g when users close the messenger the bubble is shown by default so we briefly see the messenger before it is hidden.

0


image avatar

Destiny

Zendesk Customer Care

Hello Shirley, 
 
Thank you for reaching out. 
 
Yes, the behavior you are describing with the Zendesk Messenger is expected when using the JavaScript API to control its visibility. When you call the zendeskAPI('messenger', 'close') method, it triggers the closing animation of the Messenger window, and if you are not calling zendeskAPI('messenger', 'hide') until the 'close' event gets fired, the default state after closing the Messenger is to show the launcher bubble, which is why you might briefly see the bubble before it gets hidden.
 
Your code is attempting to immediately hide the bubble after closing, but there can be a short delay causing the bubble to appear momentarily. This is due to the lifecycle of the messenger's animations and the event handling by the browser's JavaScript engine.
 
I hope this information helps. 

0


Please sign in to leave a comment.