Appzi Docs

Listening to widget events

Listening to widget events

You can hook onto Appzi widget 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 widget was open

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

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