#Events

Most actions completed by a visitor will trigger custom events for which you will be able to assign a listener.

#Usage

.on(name: String, callback: Function): this

.off(name: String, callback: Function): this

#Available events

#ready

  • Arguments: { event: { element: { name: String, slug: String } } }
Triggered when the element is fully loaded and displayed inside the page.

#seen

  • Arguments: { event: { element: { name: String, slug: String } } }
Triggered when the element has been seen by the user (when it has entered the browser's viewport).

#click

  • Arguments: { event: { id: String, type: String, originalEvent: MouseEvent, url: String, name: String, element: { name: String, slug: String } } }
Triggered when a user has clicked a button/link inside the element.

#formSubmit

  • Arguments: { event: { fields: { [fieldKey]: Any, ... }, valid: { [fieldKey]: Boolean, ... }, element: { name: String, slug: String } } }
Triggered when a user submits a form inside an element.
For example, thanks to this event, you'll be able to save a user's provided informations using tools such as a DMP.

#destroy

  • Arguments: { event: { buttonId?: String, originalEvent: MouseEvent, element: { name: String, slug: String } } }
Triggered when a user has clicked a button/image configured to destroy element.

#error

  • Arguments: { event: { message: String, element: { slug?: String } } }
Triggered when an error occurred while displaying an element.