The Partoo Chat provides several events that allow you to monitor actions performed by visitors directly on your website.
How Do Partoo Chat Events Work?
The Partoo Chat widget dispatches native JavaScript CustomEvent directly on the window object.
All events are prefixed with partoo_widget: to avoid conflicts with other scripts running on your website.
To listen for an event, simply register an event listener on the window object.
Event data is available through the event.detail property.
Example
window.addEventListener('partoo_widget:channel_selected', (event) => {
console.log(event.detail);
// { channel: 'Whatsapp' }
});
💡 We recommend registering your event listeners as early as possible during page load, ideally within the <head> tag, to ensure that no events are missed during widget initialization.
Available Events
1. partoo_widget:widget_loaded
This event is triggered once the Partoo Chat has finished initializing and is ready for visitors to interact with.
Payload: (empty object)
2. partoo_widget:channel_selected
This event is triggered when a user selects or opens a messaging channel within the widget.
Payload:
Field | Type | Values |
|
|
|
3. partoo_widget:message_sent
This event is triggered when a user sends a message through the Partoo Chat.
Payload:
Field | Type | Description |
|
|
|
|
| Identifier of the ongoing conversation |
