Listening to Events

Integrate your application with the ServiceBell widget by listening for and reacting to events

The ServiceBell widget triggers events on the global window object in JavaScript that can be listened for and reacted to. Some of these events will get triggered by calls to the ServiceBell JavaScript API, but they can also be triggered by visitor interaction with the widget, or by admins interacting with visitors via the ServiceBell dashboard.

Conversion Event Tracking Example

A popular use case for the Events API is conversion tracking. the sb:callstart event will be fired whenever a call is accepted by a visitor, and you can listen for these events like so:

window.addEventListener("sb:callstart", () => {

    gtag('event', 'callstart', {
      'event_category': 'chat',
      'event_label': 'sb:callstart',
    });

});

Refer to GA4 documentation to set up events, set up event parameters, and mark events as conversions.

Events

Last updated