Skip to content

ExitPoll

Overview

ExitPoll allows you to serve qualitative survey questions to your users.

This only requires a few lines of code and some question creation on your Cognitive3D dashboard. This page will walk you through the process of enabling and configuring an ExitPoll in your application.

Creating an ExitPoll

ExitPoll Hooks and Question Sets are created on the Cognitive3D Dashboard. A Hook is requested from the application during the experience and receives a Question Set as a response. This allows you to use change Question Sets without having to rebuild or redeploy your app.

The following example will display a Question Set.

Step 1: Create a new Question Set

Press the New Question Set button.

Add your questions. Each question will be displayed as a panel one at a time.

Select Create Question Set.

Step 2: Create a new Hook

Select Manage Hooks.

Click "New Hook" to open the hook creation popup.

Step 3: Assign your Question Set to your Hook

Assign your Question Set and version for the Hook.

Step 4: Request Question Set from your app

Then on your project, use the Hook name we created to request the assigned Question Set.

The c3d.getQuestionSet() method will return an object with the questions.

You can also use c3d.getQuestionSetString(); which returns a string of the questions.

let myHook = 'app_test_js';

c3d.requestQuestionSet(myHook)
    .then(()=>{
        let object = c3d.getQuestionSet();      // Returns json                
        myVoiceReponse = myMicrophoneReponse(); // Voice reponses require a .wav file encoded in base64 format.

        // After receiving the response, you can add answers to the active Question Set by calling addAnswer:
        c3d.exitpoll.addAnswer('BOOLEAN', 1);            // Question #1 answer is True. Our system counts "1" as True and "0" as False.
        c3d.exitpoll.addAnswer('HAPPYSAD', 1);           // Question #2 answer is "Happy" 
        c3d.exitpoll.addAnswer('THUMBS', 1);             // Question #3 answer is "Thumbs up"
        c3d.exitpoll.addAnswer('MULTIPLE', 2);           // Question #4 answer is answer #3, "awesome" (json example available below)
        c3d.exitpoll.addAnswer('SCALE', 7);              // Question #5 answer is 7/10
        c3d.exitpoll.addAnswer('VOICE', myVoiceReponse); // Question #6 answer is a base64 string encoded from a .wav file
        c3d.exitpoll.sendAllAnswers();                   // Send all answers to server
    });

An example JSON you could get from the c3d.getQuestionSet(); method:

{
  "id": "app_test_js:1",
  "name": "app_test_js",
  "customerId": "someCustomerId",
  "status": "active",
  "title": "Welome to the JS SDK",
  "version": 1,
  "questions": [
    {
      "type": "BOOLEAN",
      "title": "Do you like Javascript?"
    },
    {
      "type": "HAPPYSAD",
      "title": "How does Javascript make you feel?"
    },
    {
      "type": "THUMBS",
      "title": "Javascript. Thumbs up or down?"
    },
    {
      "type": "MULTIPLE",
      "title": "How would you describe Javascript?",
      "answers": [
        {
          "icon": null,
          "answer": "nice"
        },
        {
          "icon": null,
          "answer": "cool"
        },
        {
          "icon": null,
          "answer": "awesome"
        },
        {
          "icon": null,
          "answer": "the best"
        }
      ]
    },
    {
      "type": "SCALE",
      "title": "How much do you like scales out of 10?",
      "minLabel": "1",
      "maxLabel": "10",
      "range": {
        "end": 2,
        "start": 0
      }
    },
    {
      "type": "VOICE",
      "title": "voice",
      "maxResponseLength": 20
    }
  ]
}