Survey answer submitted

Survey Answer Submitted

Overview

The onSurveyAnswerSubmitted API triggers custom functionality when a survey answer is submitted in VWO surveys. It provides access to the data related to the submitted answers, including question details and visitor responses.

Signature

window.VWO.push(['onSurveyAnswerSubmitted', function(data) {
    // Add your custom code here
}]);

Callback Data

Type: Object containing below information

ParameterData TypeRequiredDescription
accountIdnumberYesThe VWO account ID.
surveyIdnumberYesThe survey campaign ID of the survey being answered.
uuidstringYesThe unique identifier for the visitor.
questionIdnumberYesThe unique ID of the question being answered.
questionTypestringYesThe type of the question (e.g., "multi_line", "checkbox", "radio").
questionTextstringYesThe text of the question being answered.
answersarrayYesAn array of answer objects containing id (number) and value (string).
skippedbooleanNoIndicates whether the visitor skipped the question. If true, the question was skipped.

Example

window.VWO = window.VWO || [];
window.VWO.push(['onSurveyAnswerSubmitted', function(data) {
    // Custom functionality for survey answer submission
    console.log("Survey answer submitted:", data);
}]);

Sample Data Object

Text Response (multi-line):

{
    "accountId": 307590,
    "surveyId": 293,
    "uuid": "D37EF4336FD3C784165C6D2BEBDACE430",
    "questionId": 2005,
    "questionType": "multi_line",
    "questionText": "What could we do to make this site more useful?",
    "answers": [
        {
            "id": 1,
            "value": "Add multiple theme options"
        }
    ]
}

Use-cases

  • Customer Data Integration: Use this callback to tag survey answers with visitor data and send it to your Customer Data Platform (CDP) or data warehouse for deeper analysis.
  • Behavior Analysis: Push survey response data to analytics tools like Google Analytics to track visitor behavior, such as response patterns and survey interactions.
  • CRM Integration: For sales teams, integrate survey responses into your CRM system to refine strategies based on customer feedback, such as identifying competitors being evaluated.

You may also refer to the following article: https://vwo.com/product-updates/vwo-survey-api/