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

Return to top


  • Tom Derbyshire

    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!

  • 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!

Please sign in to leave a comment.

Powered by Zendesk