Survey Event Handlers for Cordova

Covered here is how to set up the event handler that fires before and after every survey is shown for your Cordova apps.

You can execute code in a handler that gets called before a survey is shown and after it has been dismissed. You can use this for things like pausing and resuming a game, for example.

Before Showing the Survey

Surveys.setOnShowHandler(
  function () {
 		console.log('On show survey');
  },
  function (error) {
 		console.log('On show handler could not be set ' + error);
  }
);

After the Survey Has Been Dismissed

Surveys.setOnDismissHandler(
  function () {
 		console.log('On dismiss survey');
  },
  function (error) {
 		console.log('On dismiss handler could not be set ' + error);
  }
);

What’s Next

Do more with event handlers, like adding user attributes and events as well as additional logs.