Displaying surveys and nudges with the API

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:

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 our JS loads without disableAuto.

showNudge (aka showSurvey): Show a specific survey and optionally ignore its targeting options.

stopNudge: Hide any current running survey.

To disable the automatic displaying of surveys add the following line right below the var _kiq = []; in your snippet.

_kiq.push(['disableAuto']);

Then to manually show a survey you can make the following API call:

_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:

_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.

Have more questions? Submit a request
Powered by Zendesk