Triggering Surveys
You can trigger Appzi surveys programmatically using JavaScript. This is useful for triggering surveys from custom buttons or based on user interactions.
Inline Trigger
Section titled “Inline Trigger”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.
Ready Callback
Section titled “Ready Callback”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"); };},};HTML Attribute
Section titled “HTML Attribute”Mark any element as a survey trigger without JavaScript:
<a data-az-l="CONFIG_ID">Leave Feedback</a>Page Load Trigger
Section titled “Page Load Trigger”To show a survey when the page loads:
window.appziSettings = {ready: function (appzi) { appzi.openSurvey("CONFIG_ID");},};