Embedded
Opening chat programmatically
Overview
You can programmatically open the webchat widget from your webpage by dispatching the stubber_webchat_chat_open event on the window. This is useful when you want to trigger the chat from a custom button, link, or any other user interaction on your page rather than relying on the default webchat launcher.
Usage
Dispatch a stubber_webchat_chat_open event on the window object to open the chat:
When this event is fired, the webchat widget will:
- Enable the webchat if it is not already enabled
- Open the chat window
- Establish a connection to the webchat service
Example
Opening chat from a custom button
Opening chat based on page behaviour
You can also trigger the chat open event based on other conditions, such as time spent on a page or scroll position: