ServiceBell
Search…
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:
1
window.addEventListener("sb:callstart", () => {
2
ga('send', 'event', 'Videos', 'play', 'Fall Campaign');
3
});
Copied!

Events

Event name
Description
sb:initialized
Emits when the widget is fully initialized and ready to be interacted with.
sb:error
Emits if a critical error is encountered during widget initialization. The error is included in event.detail.
sb:expand
Emits on the widget going into its expanded state, either by the visitor clicking on the widget or by calling ServiceBell.expand().
sb:collapse
Emits on the widget going into its collapsed state, either by the visitor clicking on the widget or by calling ServiceBell.collapse().
sb:callaccept
Emits on the visitor accepting a call that was initiated either proactively or reactively.
sb:callreject
Emits on the visitor rejecting a call that was initiated either proactively or reactively.
sb:dialstart
Emits on the widget requesting assistance, either by the visitor clicking on the dial button or by calling ServiceBell.dial()
sb:dialcancel
Emits on the dial canceling, either by the visitor clicking "Cancel" or the "X" button on the top right of the widget while dialing.
sb:dialmiss
Emits on the widget going into the dial missed state after a period of time elapses after dialing but nobody answered the request for help.
sb:callstart
Emits on an admin starting a call with a visitor. This will emit before the visitor explicitly presses "accept" on the call.
sb:callend
Emits on a call ending, either by the visitor ending it, the admin ending it, or from a network connectivity issue.