Skip to main content
All CollectionsWebsite SurveysFAQs
Javascript Response Callback
Javascript Response Callback

Get notified whenever a visitor responds to your survey

Updated over a week ago

You can use the 'onResponse' method of our Javascript SDK to set a callback method which will be called every time a question is answered.

Once you've installed the Iterate script on your site, set your callback method as shown below

Iterate('onResponse', (question, response, additionalData) => {
    // Your code here
})


Your callback will be passed 3 parameters

question: A string of the prompt of the question that was answered. e.g. "What's your name?"
response: A string of the response of the question, e.g. "Mike"
additionalData: an object including the entire question and response data objects

In most cases you'll only need to use the question and response parameters, but if you have additional needs like getting the survey id or other information, you can use the additionalData parameter.

Did this answer your question?