Hooks
Last updated
Last updated
Hooks allow executing custom JavaScript functions upon interacting with slides. For example, calling a third-party tracking endpoint when the next button of a form slide is clicked. Each slide-type defines different hook types that can be configured on each slide JavaScript section:
In order to define a hook on a slide, we need to define the hook type and a callback function. The callback function includes two parameters: a done function and an optional data parameter. The done function has to be called after the custom code has been executed, otherwise, the default flow will be interrupted. The data parameter contains contextual information related to the hook. The extension parameter is an internal parameter needed to define the hook.
Question slide
onSelect: Executed when an option is clicked. The data parameter contains the index of the selected option.
onSkip: Executed when the Skip button is clicked.
onNext: Executed when the Next button is clicked.
Form slide
onSend: Executed when the Next button is clicked.
onSkip: Execute when the Skip button is clicked.