This article was automatically translated by artificial intelligence. For accurate information, please refer to the original English version.
Partoo Chat provides several events that allow you to track actions performed by visitors directly from your website.
How do Partoo Chat events work?
The Partoo Chat widget sends native JavaScript events of type CustomEvent directly to the window object.
All events are prefixed with partoo_widget: to avoid conflicts with other scripts on your site.
To listen for an event, simply add an event listener on the window object.
Information associated with the event is available in 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 your page load, ideally within the <head> tag, to avoid missing any events during widget initialization.
List of available events
1. partoo_widget:widget_loaded
This event is triggered once Partoo Chat has finished initializing and is ready for visitors to use.
Data sent: (empty object)
2. partoo_widget:widget_opened
This event is triggered when a user opens Partoo Chat.
Data sent: (empty object)
3. partoo_widget:widget_closed
This event is triggered when a user closes Partoo Chat.
Data sent: (empty object)
4. partoo_widget:channel_selected
This event is triggered when a user selects or opens a messaging channel in the widget.
Data sent:
Field | Type | Value |
|
|
|
5. partoo_widget:message_sent
This event is triggered when a user sends a message from Partoo Chat.
Data sent:
Field | Type | Description |
|
|
|
|
| Current conversation identifier |
