How to make the widget appear after a trigger

Using the JavaScript API, you can delay the widget’s appearance until the first trigger message has been sent on your site. In this article, we’ll show you how to do it by combining the onBeforeLoad callback function and the hideWidget(); action followed by the onChatMessageSystem callback function with the showWidget(); action from the JavaScript API Documentation.

Adding the JavaScript below to the embedded Widget Code will force the widget to be hidden before it’s loaded. It will still be there. However, your visitors won’t be able to see it. Once a trigger fires, however, the widget becomes fully visible and the visitor can engage in conversation as usual. 

To find your Widget Code, check out this article: Where can I find the property and widget IDs?

Just add the center portion of the code below (lines 4-12) to your widget code before the end of the script as shown below:

For more ways to make changes to how the widget looks and behaves, check out our other JavaScript API articles in the tawk.to Help Center.

Was this article helpful?

11 out of 15 liked this article

Still need help? Message Us