You can choose to manually display surveys with our Javascript API. Make sure all surveys you intend to show are active on your dashboard.
Below is a description of each call:
selectSurvey: When no surveys are currently showing this function will try and display a survey that matches the targeting options. Same as what happens when our JS loads without disableAuto.
showSurvey: Show a specific survey and optionally ignore its targeting options.
stopSurvey: Hide any current running survey.
To disable the automatic displaying of surveys add the following line right below the var _kiq = [];
in your snippet.
window._kiq.push(['disableAuto']);
Then to manually show a survey you can make the following API call:
window._kiq.push(['showSurvey', 'SURVEY ID']);
Calling showSurvey will still respect your targeting options except the URL. If you would like to force the survey to show regardless of targeting options and if the user has already taken the survey you can pass a third parameter of true. Example:
window._kiq.push(['showSurvey', 'SURVEY ID', true]);
To find the Survey ID so you can add this code, go to the Edit or Targeting tab of your survey, and copy the number in the URL.
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.
Comments
0 comments
Article is closed for comments.