Is there a concise/elegant way to check if a live agent is available? I'd like to show certain elements depending on whether or not an agent is available. The closest thing I found so far was this, but its from 3 years ago so I'm not sure if it's still up to date, or if there exists a better way of doing so.
1 Answer
There is an example in the chat button code that does that for you.
if (!window._laq) { window._laq = []; }
window._laq.push(function(){
liveagent.showWhenOnline('<Chat Button Id Here>', document.getElementById('<Online Element Id Here>'));
liveagent.showWhenOffline('<Chat Button Id Here>', document.getElementById('<Offline Element Id Here>'));
});
-
-
There is code you need to copy from the Deployment as well. Commented Jun 20, 2017 at 18:10