How to Display the Survey With the API
In Qualaroo, you can opt to display a survey using the JavaScript API, provided the survey is active on your dashboard.
You can call the following function to display the survey manually:
-
selectNudge: When no surveys are currently showing, this function will try and display a survey that matches the targeting options. Same as what happens when JavaScript loads without the disableAuto function.
-
showSurvey: Show a specific survey and optionally ignore its targeting options.
-
stopSurvey: Hide any current running survey.
Displaying the surveys manually with Javascript API is quite helpful in:
-
Preventing the survey from automatically loading itself.
-
Showing the survey at a particular event for more responses.
How to Display the Survey Manually Using the JavaScript API
Step 1: Disable the automatic displaying of the survey by adding
Below the variable
Step 2: Make the following API call to display a survey.
Calling the “showSurvey” function will work according to your targeting options except for the URL. If you want to display the survey regardless of targeting options and if the user has already taken the survey, you can pass the third parameter “true” like this:
Step 3: To locate the Survey ID,
-
Navigate to the EDIT or TARGETING tab.
-
Copy the survey ID from the URL and replace “SURVEY ID” in the code with the number.
Your survey will display manually when the browser loads the JavaScript APIs.
That is all about manually displaying the nudges with JavaScript APIs.