Help Center

Subscribe events

Important: We recommend that this documentation be read and used by developers.


What is a Subscribe event and what can it be used for?


Subscribe events are built-in JavaScript methods that take the selected event and allow it to be listened to each time it is triggered. They take a second argument to call each time the described event is triggered, this second argument consists of a function of type callback that allows you to perform client actions and can take parameters depending on each event.


If, for example, you are interested in measuring each time a user closes the chat window in your own analysis, what you should do is run this function:


<script type="text/javascript">


$aivo.ready(function() {


$aivo.subscribe.onCloseWindow(function () {


    // Here you can perform the trace execution for your analysis.


});


});


</script>


And specify in the callback function the measurement sentence.


This can also be used for other actions. 


Below we list all the user interactions with the chat window that can be used.


+ onOpenWindow: 


Subscribe to the event that opens the chat window and define which function should be executed when this happens.


Example: 


$aivo.subscribe.onOpenWindow(function(){console.log('Chat window opening event')})


+ onMinimizeWindow: 


Subscribe to the event that opens the chat window and define which function should be executed when this happens.


Example: 


$aivo.subscribe.onMinimizeWindow(function(){console.log('Minimize the chat window event')})


+ onCloseWindow


Subscribe to the event that opens the chat window and define which function should be executed when this happens.


Example: 


$aivo.subscribe.onCloseWindow(function(){console.log('Event that closes the chat window')})


+ onOpenMaximize


Subscribe the event that opens the chat window and define which function should be executed when this happens.


Example: 


$aivo.subscribe.onOpenMaximize(function(){console.log('Maximize chat window event')})


+ onCloseCtaButtons


Subscribe to the event that detects the closure of the cta complement with buttons.


Example: 


$aivo.subscribe.onCloseCtaButtons(function(){console.log('Event on closing cta with buttons from chat window')})


+ onShowButton


Subscribe the event that detects the loading of a button type add-on.


Example: 


$aivo.subscribe.onShowButton(function(){console.log('Event when loading complement with buttons')})


+ onSelectedButton


Subscribe event that detects when a complement of type button is clicked. Receives value from the button.


Example: 


$aivo.subscribe.onSelectedButton(function(value) { 


console.log('The user selected the button:', value)


})



+ onShowCarousel


Subscribe to the event that detects the loading of a carousel type add-on.


Example: 


$aivo.subscribe.onShowCarousel(function(){console.log('Event when loading the carousel complement')})


+ onSelectedButtonCarousel


Subscribe to the event that detects the pressing of a carousel button. Receives the value of the button and the active item when submitting.


Example: 


$aivo.subscribe.onSelectedButtonCarousel(function(value, itemActive) { 


console.log('The button selection with value: ', value, ' on item:' , itemActive)


})


+ onInteraction


Subscribe event that detects a message being sent. Returns the interaction type and question


Example: 


$aivo.subscribe.onInteraction(function(type, question) { 


console.log('Held an interaction of type: ', type, ' and question: ', question)


})


+ onFeedbackIntention


Subscribe to the event that detects the sending of feedback by intent. Returns the value of the intent and the ID of the response.


Example: 


$aivo.subscribe.onFeedbackIntention(function(value, answerId) {


console.log('Sent feedback: ', value, ' with the following response id: ', answerId)


})


$aivo.subscribe.onDerivationLive(function() { ... })


+ onDerivationLive


Subscribe to the event that detects a referral to Live


Example: 


$aivo.subscribe.onDerivationLive(function() {


console.log('Event detecting a live referral')


})


+ onShowAdvert


Subscribe to the event that detects the loading of a trigger.


Example: 


$aivo.subscribe.onShowAdvert(function() {


console.log('Event detecting the loading of a trigger)


})


+ onFirstInteraction


Subscribe to the first interaction. Return element selected in the first interaction


Example: 


$aivo.subscribe.onFirstInteraction(function(element) {


console.log('The first interaction with the bot was performed, selecting the following element:', element)


})


+ onShowForm


Subscribe when loading a form. Return form title


Example: 


$aivo.subscribe.onShowForm(function(title) {


console.log('The following form is displayed:', title)


})


+ onSubimitForm


Subscribe when submitting a form. Title of the return form


Example: 


$aivo.subscribe.onSubimitForm(function(title) {


console.log(The following form was submitted:', title)


})


+ onShowSurvey


Subscribe by displaying a satisfaction survey. Returns the type of survey and whether the form field is active.


Example: 


$aivo.subscribe.onShowSurvey(function(type, comment) {


console.log('The default survey view was performed: ', type, ' and comment settings: ', comment)


})


+ onSelectedSurvey


Subscribe when selecting the value of a satisfaction survey. Returns survey type and modified value


Example: 


$aivo.subscribe.onSelectedSurvey(function(type, value) {


console.log('Selected a survey of type: ', type, ' con value: ', value)


})


+ onBlurComment


Subscribe when leaving the comment field focus. Returns the survey type


Example: 


$aivo.subscribe.onBlurComment(function(type) {


console.log('Clicked outside the comment field on the survey type: ', type)


})


+ onSubimittedSurvey


Subscribe when submitting the survey. Returns the survey type, value, and true or false in case of comment submission.


Example: 


$aivo.subscribe.onSubimitSurvey(function(type, value, comment) {


console.log('Sent the survey type: ', type, ' with value: ', value, ' and comment: ', comment)


})


+ onCloseSurvey


Subscribe when closing the survey without sending. Returns the type and value of the survey.


Example: 


$aivo.subscribe.onCloseSurvey(function(type, value) {


console.log('Forced survey close performed: ', type, ' with value: ', value)


})




This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media. To find out more about the cookies we use, see our Privacy Policy.

If you decline, your information won’t be tracked when you visit this website. A single cookie will be used in your browser to remember your preference not to be tracked.