Disclaimer: This article is provided for instructional purposes only. MorgWard does not support or guarantee the code. Please post any issues you have in the comments section or try searching for a solution online.
Question
When hiding the widget on page load using the hide API, the widget does not automatically unhide itself to present a triggered message. Is it possible to hide the widget on my website until a message from a Chat trigger is sent to the visitor?
Answer
By default, the widget will remain hidden if a triggered message is sent while using the hide API. However, you can make use of the on chat:unreadMessages API to override this and present the triggered message.
Below is an example API script that will first hide the widget on page load, and then automatically show and open the widget to present a triggered message when a new unread message is detected:
<script id="ze-snippet"
src="https://static.zdassets.com/ekr/snippet.js?key=ACCOUNT_KEY"> </script>
<script type="text/javascript">
zE('webWidget', 'hide');
zE('webWidget:on', 'chat:unreadMessages', function(number) {
zE('webWidget', 'show');
zE('webWidget', 'open');
});
</script>
For further customizations, see the article: Advanced customization of your Web Widget.
Comments
0 comments
Please sign in to leave a comment.