After you’ve installed our Live Chat Widget on your site, you can programmatically toggle the chat widget open and closed using Javascript.

Use FuseDeskChatNS.toggle() to toggle the widget open and closed.

To make sure that the you don’t try and toggle the chat widget before it’s loaded, you can wrap your code inside of FuseDesk Namespace as follows so that after the widget loads, your code is run:

window.FuseDeskChatNS = function(FuseDeskChatNS) {
     FuseDeskChatNS.toggle();
}

If you wanted to have a link that when clicked opened the chat widget, you could simply set the onclick for the link like so:

<a onclick="FuseDeskChatNS.toggle();">Open Chat</a>

Alternatively, and more simply, if you’re just looking to open the chat based on certain events like what page someone is one or how long they’ve been on a page, use our Live Chat Automations!