*Important: we recommend that this documentation be read and used by developers.
The subscribe events are built-in JavaScript methods that take the selected event and allow it to be listened to each time its execution is generated, receiving a second argument to call when the described event is triggered, which consists of a callback type function.
These make it possible to execute client actions and receive parameters depending on each event.
If, for example, you are interested in measuring the number of times a user closes the chat window in your own analytics, what you should do is execute this function;
| <script type="text/javascript"> $aivo.ready(function() { $aivo.subscribe.onCloseWindow(function () { // Here you will be able to perform the tracking execution for your analytics }); }); </script> |
And specify in the callback function the measurement statement.
They can also be used for other actions. Below we list all the user interactions with the chat window where you can implement them.
| Event Description | Example |
| onOpenWindow: subscribe to the event that opens the chat window and define which function should be executed when this happens. | $aivo.subscribe.onOpenWindow(function(){console.log('Chat window opening event')}) |
| onMinimizeWindow: subscribe to the event that minimizes the chat window and define which function should be executed when this happens | $aivo.subscribe.onMinimizeWindow(function(){console.log('Minimize chat window event)}) |
| onCloseWindow: subscribe to the event that closes the chat window and define which function should be executed when this happens. | $aivo.subscribe.onCloseWindow(function(){console.log('Chat window closing event')}) |
| onOpenMaximize: subscribe to the event that maximizes the chat window and defines which function should be executed when this happens. | $aivo.subscribe.onOpenMaximize(function(){console.log('Event to maximize the chat window')}) |
| onCloseCtaButtons: subscribe to the event that detects the closing of the account complement with buttons. | $aivo.subscribe.onCloseCtaButtons(function(){console.log('Event when closing account with chat window buttons')}) |
| onShowButton: subscribe to the event that detects the load of a button type plugin | $aivo.subscribe.onShowButton(function(){console.log('Event when loading add-on buttons')}) |
| onShowCarousel: subscribe to the event that detects the loading of a carousel plugin. | $aivo.subscribe.onShowCarousel(function(){console.log('Event when loading carousel plugin')}) |
| onSelectedButtonCarousel: subscribe to the event that detects the pressing of a carousel button. Receives value of the button and active item when sending. | $aivo.subscribe.onSelectedButtonCarousel(function(value, itemActive) {console.log ('The selection of the button with the value: ', value, ' in the item:' , itemActive)}) |
| onInteraction: subscribe to the event that detects the sending of a message. Returns interaction type and question | $aivo.subscribe.onInteraction(function(type, question) {console.log ('An interaction of the type: ', type, ' and asks: ', question)}) |
| onFeedbackIntention: subscribe to the event that detects the sending of feedback by intention. Returns value of the intent and id of the response. | $aivo.subscribe.onFeedbackIntention(function(value, answerId) {console.log('Feedback was sent: ', value, ' with the following answer id: ', answerId)}) |
| onDerivationLive: subscribe to the event that detects a live referral | $aivo.subscribe.onDerivationLive(function() {console.log ('Event that detects a referral to live')}) |
| onShowAdvert: subscribe to the event that detects the loading of a trigger | $aivo.subscribe.onShowAdvert(function() {console.log ('Event that detects the load of a trigger')}) |
| onFirstInteraction: subscribe the first interaction. Returns element selected in the first interaction | $aivo.subscribe.onFirstInteraction(function(element) {console.log ('The first interaction with the bot was carried out, selecting the following element:', element)}) |
| onShowForm: subscribe when loading a form. Returns form title | $aivo.subscribe.onShowForm(function(title) {console.log ('The following form is displayed:', title)}) |
| onSubimitForm: subscribe when submitting a form. Returns form title | $aivo.subscribe.onSubimitForm(function(title) {console.log ('The following form is sent:', title)}) |
| onShowSurvey: subscribe when showing a satisfaction survey. Returns survey type and if the form field is active. | $aivo.subscribe.onShowSurvey(function(type, comment) {console.log ('The visualization of the sample survey was carried out: ', type, ' and comment settings: ', comment)}) |
| onSelectedSurvey: subscribe when selecting a satisfaction survey value. Returns survey type and modified value | $aivo.subscribe.onSelectedSurvey(function(type, value) {console.log('A selection was made from the sample survey: ', type, ' with a value of: ', value)}) |
| onBlurComment: subscribe when leaving the focus of the comment field. Returns survey type | $aivo.subscribe.onBlurComment(function(type) {console.log('A click was made outside the comment field in survey type: ', type)}) |
| onSubimittedSurvey: subscribe when sending the survey. Returns survey type, value and true or false in case of sending comment. | $aivo.subscribe.onSubimitSurvey(function(type, value, comment) {console.log ('The survey type: ', type, ' was sent with a value of: ', value, ' and comment: ', comment)}) |
| onCloseSurvey: subscribe when closing the survey without sending. Returns survey type and value. | $aivo.subscribe.onCloseSurvey(function(type, value) {console.log ('The survey was forcibly closed: ', type, ' with a value of: ', value)}) |
| OpenWebview: subscribe to the event that opens the webview and define which function should execute when this happens. | $aivo.subscribe.onOpenWebview(function(){console.log('Webview open event')}) |
| onCloseWebview: subscribe to the event that closes the webview and define which function should execute when this happens | $aivo.subscribe.onCloseWebview(function(){console.log('Webview close event')}) |
| onShowVideoCall: subscribe to the event that triggers when the window user answers a video call and define which function should execute when this happens. | $aivo.subscribe.onShowVideoCall(function(){console.log('Event triggered when the window user answers a video call')}) |
| onCloseVideoCall: subscribe to the event that triggers when a video call ends and define which function should execute when this happens. | $aivo.subscribe.onCloseVideoCall(function(){console.log('Event triggered when a video call ends')}) |
onIncomingVideoCall: subscribe to the event that is triggered when the incoming call popup is displayed. Defines the function that should be executed when the call pop-up appears in the window. | $aivo.subscribe.onIncomingVideoCall(function(){ console.log('Event triggered when incoming call popup is displayed'); }); |
onIncomingVideoCallEnd: subscribe to the event that is triggered when the incoming call pop-up disappears. Defines the function that should be executed when the call popup is hidden or the incoming call is terminated. | $aivo.subscribe.onIncomingVideoCallEnd(function(){ console.log('Event triggered when incoming call popup disappears'); }); |