Skip to content

Triggering Surveys

You can trigger Appzi surveys programmatically using JavaScript. This is useful for triggering surveys from custom buttons or based on user interactions.

The simplest way to trigger a survey from your own button:

<button onclick="appzi && appzi.openSurvey('CONFIG_ID')">Leave Feedback</button>

The appzi && check ensures the script has loaded before calling.

For guaranteed access to the Appzi API, use the ready callback:

window.appziSettings = {
ready: function (appzi) {
document.getElementById("feedback-btn").onclick = () => {
appzi.openSurvey("CONFIG_ID");
};
},
};

Mark any element as a survey trigger without JavaScript:

<a data-az-l="CONFIG_ID">Leave Feedback</a>

To show a survey when the page loads:

window.appziSettings = {
ready: function (appzi) {
appzi.openSurvey("CONFIG_ID");
},
};