In-App Surveys

This page covers the APIs specific to in-app surveys for React-Native apps.

The best and most effective way to collect data about your application and evaluate it is directly asking the ones who are using it. Your actual customers are an asset that you can use to answer a lot of questions and make decisions. We built the in-app surveys specifically to fulfil this need. The good thing is, setting up those surveys from the dashboard, controlling them from the application and accessing their result can be done easily.

Creating a Survey

You can choose between two types of surveys when creating a new one: Custom and NPS.

Custom Survey

You can create your own custom surveys and have it display any number of questions sequentially. You can do this adding one of 3 types of questions:

  • Text Field: This question will be answered via a text field
  • Multiple Choice: This question can be answered by choosing one of any number of answers you have added via the dashboard
  • Stars: This question can be answered by choosing a 1 to 5 star rating

NPS Survey

You can change the text for any of the questions of an NPS survey. Depending on the rating given by the user, they will be redirected to one of two possible questions:

  • User rating is 9 or 10: A link is first generated to the app on the App Store, then the user will be asked to rate the app on the App Store. If the user accepts, they will be redirected to the App Store. If this is the beta version, or if the app is not available on the App Store, the user will instead be asked to submit the survey
  • User rating is less than 9: they will be asked how the app can improve

Targeting Surveys

You can choose criteria that your users have to meet in order for the surveys to appear in different ways.

Auto Targeting Surveys

After choosing the survey type, you can target different audience using custom conditions. When you create an auto targeting you pick the criteria for the users who should receive the survey. The users matching the conditions will see the survey automatically. You can set the criteria to be custom user attributes or user events you created.

Manual Targeting Surveys

After choosing the survey type, you can target different audience using manual targeting. You can manually control when a manual targeting survey should show up. Each created survey has a unique token that you can refer to in your code as explained in the following section.

Once, you publish a manual targeting survey, you can use the unique token that was generated in your application.

Controlling Displaying Surveys

You can control already published surveys to provide a better and more fluid user experience.

Controlling the Auto Targeting Surveys

You can have auto targeting surveys show automatically at the start of a session or show it manually.

Showing Automatically

By default, a survey will be presented as soon as the criteria set from the dashboard are met. Surveys that meet the auto targeting criteria will automatically be shown within 10 seconds of the application being opened. In the case of multiple surveys having their criteria met, they will be shown one by one.

Showing Manually

You can show auto targeting surveys at any time if there are available surveys that meet the criteria. To do this, first disable the automatic showing using the following API.

Surveys.setAutoShowingEnabled(false);

Then present the surveys manually at an appropriate time using the below APIs.

Surveys.showSurveyIfAvailable();

Controlling the Manual Targeting Surveys

Sometimes, it's you'd like to show only specific users surveys, like users who opt-in to take these surveys. For these users, it's a better idea to show a manually targeted survey. You can use the following API to show a survey with a specific token. Manual targeting surveys can be displayed to the user any number of times.

Surveys.showSurvey("TOKEN");

You can also check if the current user has responded to a specific survey before or not through the following API.

Surveys.hasRespondedToSurvey("SURVEY_TOKEN", function(hasResponded) {
  alert("Has Responded: "+hasResponded);
});

Showing the Welcome Screen

You can show an initial welcome screen for the survey rather than show the first question immediately. To do this, you can enable it using the following method.

Surveys.setShouldShowWelcomeScreen(true);

Dismissed Surveys

You can set previously dismissed surveys to show again using the following method.

Surveys.setThresholdForReshowingSurveyAfterDismiss(5,10);

For an already dismissed survey to show again, two requirements must be met. These two requirements are days and sessions. For example, If the days field is set to 10 and the sessions field is set to 5, the survey will only show again after 10 days have passed AND 5 separate sessions have been initiated. By default, this is set to 4 and 4.

Setting the days and sessions fields to 0 will allow the survey to be shown again immediately.

There is a limit to showing the same surveys again

Once a survey is dismissed for the second time, it will not be shown again to the user regardless of whether or not the requirements to show have been passed again. Only surveys that have appeared less than twice can be shown. Surveys that have already been answered cannot be re-shown using this method as well. Manually showing surveys, on the other hand, has no limits.

Disable Surveys

You can can completely disable any surveys from showing in general using the following API. Please note that this also disables surveys that will be shown manually as this disables any survey related request.

Instabug.setSurveysEnabled(false);

SDK Events

Optionally, you can pass handler that gets called before a survey is shown, and after it has been dismissed. Use those for things like pausing and resuming a game for example.

Before Showing the Survey

Surveys.onShowCallback(() => {
  //Perform any changes before the survey appears.
});

After the Survey Has Been Dismissed

Surveys.onDismissCallback(() => {
  //Perform any changes before the survey disappears.
});

Showing Surveys to Older Versions

When you create and publish a new survey, you will be able to measure the number of times your survey has been shown to your users in the app, and also the number of users who saw the survey and submitted it.

Starting from version 2.11.2 Instabug captures those events (show, submit, dismiss) seamlessly.

In order to help you avoid any confusing numbers on the survey results page, Instabug shows the newly created survey to your users who have the updated version of your app that has SDK version 2.11.2 and above.

What is worth mentioning also is that doesn't apply on the old surveys; Which means if you have created a survey with an older version than 2.11.2, it shall be shown normally to your users.

Showing Surveys to Older Versions

The newly created survey will only be shown to your users who have the updated version of your app that has SDK version 2.11.2 and above.