Appzi Docs

Listening to survey events

Listening to survey events

The events API was deprecated.

You can hook onto Appzi survey events by using onEvent

window.appziSettings = {
onEvent: (evt) => {
console.warn(evt);
},
};

A few practical examples below:

Operating on submitted data

The event.data field is an array of submitted fields.

window.appziSettings = {
onEvent: (evt) => {
if (evt.type !== 'submit') {
return;
}
yourFunctionOperatingOnTheSubmittedData(evt.data);
},
};

Trigger a function when the survey was open

window.appziSettings = {
onEvent: (evt) => {
if (evt.type === 'open-survey') {
launchFireworks();
}
},
};

If you have multiple surveys on a page, you can additionally filter based on configId property (see AppziEvent for details).