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

“window._kiq.push(['disableAuto']);”

 

Below the variable

“ _kiq = [];”

 

Step 2: Make the following API call to display a survey.

 

“window._kiq.push(['showSurvey', 'SURVEY ID']);” 

 

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:

 

window._kiq.push(['showSurvey', 'SURVEY ID', true]);

 

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.

 

Survey ID

 

Your survey will display manually when the browser loads the JavaScript APIs.

 

NOTE: If you are calling the identity or custom property APIs, you will need to also call disableAutoSelect, as calling either `identity` or `set` will attempt to target a survey unless disableAutoSelect is called.

 

That is all about manually displaying the nudges with JavaScript APIs.

 

 

Was this information helpful?
© 2005 - 2024 ProProfs
-