Javascript Callbacks

Updated 2 months ago by Max Smith-Gee


Simpo allows you to track different events in the application that follow certain user behavior.

To do that, at any time, you can make calls to simpo.on(event, callback).

  • event is always a string, from the list indicated below
  • callback is a function of your choosing that gets executed when event happens

Some callbacks return payloads that contain information about the event.

For example, you can get information about the feedback left for the event feedback-filled.

simpo.on('feedback-filled', function(payload){
console.log(payload.feedback, payload.feedbackText);
});

The following methods and payloads are available to you:

Event Name

Example Payload

automation-chosen

{
id: 'some-action-id'
}

article-chosen

{
globalId: 'some-faq-id',
title: 'Some Article Title'
}

ticket-chosen

N/A

custom-support-option-chosen

{
choiceId: 'some-support-option-id'
}

webinar-chosen

{
choiceId: 'some-support-option-id'
}

chat-chosen

N/A

phone-chosen

N/A

ticket-submitted

{
ticket: {
attachment: false,
comment: 'test',
email: 'some-email@example.com',
name: 'John Smith',
subject: 'Quick question'
}
}

feedback-submit

{
app: 'announcement',
feedback: 'positive',
feedbackText: 'This is great'
user:'George Clooney'
}

Possible values for feedback are positive or negative

Possible value for app is any tool within Simpo

FEEDBACK_PROMPT_OPENED

'feedback-prompt-opened'

FEEDBACK_PROMPT_CLOSED

'feedback-prompt-closed'

closed-without-choice

{
query: 'any query that was searched',
}

automation-done

{
id: 'some-action-id',
status: 'completed',
error: {
errorMessage: 'Some error message'
}
}

Possible values for status are completed, failed, expired, cancelled, or inaccessible

walkthrough-done

{
id: 'some-walkthrough-id',
status: 'completed',
error: {
errorMessage: 'Some error message'
}
}

Possible values for status are completed, failed, expired, cancelled, or inaccessible

nps-rate

{
globalId: 'some-nps-id',
rate: 'rate-number',
user: 'some-user'
}

closed

N/A


How Did We Do?