SatisMeter’s survey for web supports the following javascript events:

  • display  - survey was displayed to user

  • progress - user answered a question

  • complete - user has completed the survey. Survey completion happens when the user either finishes the survey by going through all questions, or they close the survey after answering at least one question.

  • dismiss  - user closes the survey without answering any question.

These events can be used on the client-side for use-cases like opening a chat window upon leaving certain feedback.

Example

satismeter({
  writeKey: "XXXXXXXXXX",
  userId: "1234",
  traits: {
    createdAt: "2016-08-05T09:46:37.244Z",
...
  },
  events: {
    display: function(event) {
      console.log('survey displayed');
    },
progress: function(event) {
console.log('question answered');
},    
    complete: function(event) {
      console.log('survey submitted');
    },
    dismiss: function(event) {
      console.log('survey dismissed');
    }
  }
});

In order to provide more information about the survey and the user feedback, each callback receives an event object.

For display and dismiss, the event object contains one single field:

  • campaign: string containing the survey ID. You can find the ID of any of your surveys in Settings > Integrations > API Keys, under the section titled "Survey keys".

For progress and complete, the event object contains two fields:

  • campaign: same field as stated above.

  • answers: list of all the answers that the user has left. Each item on this list is an object with three fields:

    • id: string containing the question ID. You can find it in the same place as survey ID, i.e. in Settings > Integrations > API Keys, under the section titled "Survey keys".

    • label: string containing the question's text that was displayed to the user.

    • value: actual value of the answer.

Did this answer your question?