Callback Events

Callback Events

In some cases, it might be useful for you to receive information about the chat widget, to handle this, you can register callbacks with some events. The events are:

  1. Ready Callback - This fires when the talkative widget has finished loading. It returns a Quality of Service object (qos) which indicates what features are available. Chat, Video etc.
  2. Pre Interaction Cancelled Callback - This will be fired if there is a pre-interaction data collection field and the customer cancels their entry, either by minimizing the widget or by pressing the cancel button.
  3. Offline Callback - This is called when the chat widget goes offline. This usually happens when the customer loads the website and the widget reported as available, but it went offline during the customer's visit, usually either due to business hours or agents being at full capacity. This would be fired when the customer attempts to start the chat, and it fails.
  4. Collapse UI Callback - This is fired when the widget is collapsed or expanded. It returns a boolean of true or false.

These can be registered by adding them to the TalaktiveEngageApi object as per the following example.

window.TalkativeEngageApi = {
     readyCallback: function (qos) {
          console.log('Api Ready', qos);
     preInteractionCancelledCallback: function () {
          console.log('preInteraction cancelled');
     offlineCallback: function() {
          console.log('Offline response received');
     collapseUiCallback: function(collapsed) {
          console.log('collapse callback received. Collapsed:', collapsed);

Third Party Tracking

The Talkative Widget features integrated Google Analytics Tracking where we send events to GA based on activity like, chat starting, nudge offer being accepted etc.

Sometimes, this is not as verbose as you might like, as such, we offer a third party tracking callback. When fired, an event is populated, this event fires with all the save data that is sent to GA, but you can modify or add to it before you send it to either GA, or your own analytics tracker. To register this callback, assign it t the talkativeThirdPartyTrackingCallabck on the window object as per the following example:

window.talkativeThirdPartyTrackingCallback = (event) => {
    if (event === 'chat') {
         //dispatch some custom event to your tracking provider

If you choose to use the Third Party Tracking to report to GA, you might want to disable the built-in GA reporting, as you risk duplicating data.