Listen to events emitted by Elevio. Note that this is the only method that can be called before the load event is emitted.

Example

window._elev.on('load', function(_elev) {
  console.log('Elevio loaded', _elev);
});

Signature

window._elev.on(type, callback);

type (required)

The type of event to listen to. Can be one of:

  • load
    Called after the Elevio script has loaded, but before the Elevio app has been initialised. You should modify initial settings here. As a convenience, the callback has window._elev as it’s first argument.
  • ready
    Called after the Elevio app has been initialised.
  • widget:opened
    Called after the widget is opened.
  • widget:closed
    Called after the widget is closed.
  • module:opened
    Called after a module is opened. The callback has the module ID as it’s first argument.
  • popup:opened
    Called after a popup is opened. The callback has the article ID as it’s first argument.
  • popup:closed
    Called after a popup is closed. The callback has the article ID as it’s first argument.
  • search:query
    Called when results for a search query are shown to user. The callback has an object as it’s first argument, with query and results properties.
  • search:article:clicked
    Called when results for a search query is clicked by a user. The callback returns an object with the articleId, categoryId and the source. The source is what is defined in the elevio search element or defaults to 'custom-element' if not defined. If the link is click inside the assistant then the source is 'assistant'.
  • category:article:clicked
    Called when an article is clicked in the category display. The callback returns an object with the articleId, categoryId and the source. The source is what is defined in the elevio category custom element or defaults to 'custom-element' if not defined. If the link is click inside the assistant then the source is 'assistant'.
  • widget:article:view
    Called after an article is viewed in the widget. The callback has the article ID as it’s first argument.
  • suggestions:article:clicked
    Called after a suggestion link is clicked.The callback returns an object with the articleId and the source. The source is what is defined in the elevio suggestion custom element or defaults to 'custom-element' if not defined. If the link is click inside the assistant then the source is 'assistant'.
  • related:article:clicked
    Called after a related article link is clicked. The callback returns an object with the articleId of the link clicked, the source, and the relatedFrom which is the article ID of the article from which related articles were displayed. The source is what is defined in the elevio suggestion custom element or defaults to 'custom-element' if not defined.
  • article:interlink:clicked
    Called after an article interlink is clicked. The callback returns an object of the ID of the module or article interlink that was clicked, the type of interlink clicked (elevioModule, elevioArticle, etc) and clickedFrom which is the article ID of the article from which the interlink was clicked.
  • article:feedback:reaction
    Called after the feedback reaction icon is clicked, either positive or negative. The callback returns an object with id for article id, reaction 1 for positive 0 for negative and title with the title of the article.
  • article:feedback:text
    Called after feedback text is left for an article. The callback return on object with id for the article id, text for the text the user has submitted and title for the article title.
  • article:kblink:clicked
    Called when a user clicks on the icon to open the article in the knowledge base. The callback returns the id of the article that was clicked.

callback (required)

The function to be called. Arguments are as per the type above.