Various events are broadcasted by the Trengo Widget. Subscribe to these events to execute custom logic for your website.

Widget initialized

The event on_ready will be triggered when the widget is fully loaded, initialized and ready for use.

window.Trengo = window.Trengo || {};
window.Trengo.on_ready = function() {
    console.log('the widget is ready!');
};

Widget opened

The event on_open will be triggered when the widget is opened either by the API or by the visitor.

window.Trengo = window.Trengo || {};
window.Trengo.on_open = function() {
    console.log('the widget is opened.');
};

Widget closed

The event on_close will be triggered when the widget is closed either by the API or by the visitor.

window.Trengo = window.Trengo || {};
window.Trengo.on_close = function() {
    console.log('the widget is closed.');
};

Chat online

The event on_status_online will be triggered when the agency is available for inbound chats.

window.Trengo = window.Trengo || {};
window.Trengo.on_status_online = function() {
    console.log('the chat is online');
};

Chat offline

The event on_status_offline will be triggered when the agency is unavailable for inbound chats.

window.Trengo = window.Trengo || {};
window.Trengo.on_status_offline  = function() {
    console.log('the chat is offline');
};

Chat started

The event on_chat_started will be triggered when the visitor started a chat.

window.Trengo = window.Trengo || {};
window.Trengo.on_chat_started = function() {
    console.log('the chat has started');
};

Chat ended

The event on_chat_ended will be triggered when the agent or bot ended the chat.

window.Trengo = window.Trengo || {};
window.Trengo.on_chat_ended = function() {
    console.log('the chat has ended');
};