In-App Surveys

This page covers the APIs specific to in-app surveys for Xamarin 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

Custom Condition Surveys

After choosing the survey type, you can target different audience using custom conditions. When you create a custom condition survey you pick the criteria for the users who should receive the survey. The users matching the conditions will see the survey automatically.

Opt-in Surveys

After choosing the survey type, you can target different audience using opt-in surveys. You can manually control when an opt-in 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.

To create an opt-in survey, make sure to pick Manually from the Target Audience options.

Once, you publish an opt-in survey, a unique token is generated.

Controlling Published Surveys

You can control already publishes surveys to provide a better and more fluid user experience. Surveys that meet the custom condition criteria will automatically be shown within 15 seconds of the application being opened.

Controlling the Custom Conditions Surveys

By default, a survey will be presented as soon as the criteria set from the dashboard are met. To take control over when surveys are presented, disable automatic showing using the following API method.

//iOS
IBGSurveys.AutoShowingEnabled = false;

//Android
Surveys.SetAutoShowingEnabled(false);

Then present surveys manually at an appropriate time.

//iOS
IBGSurveys.ShowSurveyIfAvailable();

//Android
Surveys.ShowSurveyIfAvailable();

Controlling the Opt-in Surveys

Use the following API to show a survey with a specific token. Opt-in surveys can be displayed to the user any number of times.

//iOS
IBGSurveys.ShowSurveyWithToken("TOKEN");

//Android
Surveys.ShowSurvey("TOKEN");

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

//iOS
bool hasResponded = IBGSurveys.HasRespondedToSurveyWithToken("TOKEN");

//Android
bool hasResponded = Surveys.HasRespondToSurvey("TOKEN");

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.

//iOS
IBGSurveys.ShouldShowWelcomeScreen = true;

//Android 
Surveys.SetShouldShowWelcomeScreen(true);

Dismissed Surveys

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

//iOS
IBGSurveys.SetThresholdForReshowingSurveyAfterDismiss(3, 5);

//Android
Surveys.SetThresholdForReshowingSurveyAfterDismiss(3, 5);

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.

//iOS
IBGSurveys.Enabled = false;

//Android
new Instabug.Builder(this, "ANDROID_APP_TOKEN")
	.SetSurveysState(Feature.State.Disabled)
	.Build();

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

//iOS
IBGSurveys.WillShowSurveyHandler = () =>
{
  System.Console.WriteLine("New Survey");
};

//Android
Surveys.SetOnShowCallback(new IPreShowingSurveyRunnable());
public class IPreShowingSurveyRunnable : Java.Lang.Object, IOnShowCallback
{
  public void OnShow()
  {
    Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
  }
}

After the Survey Has Been Dismissed

//iOS
IBGSurveys.DidDismissSurveyHandler = () =>
{
	System.Console.WriteLine("Did Dismiss Survey");
};

//Android
Surveys.SetOnDismissCallback(new IOnDismissSurveyCallback());

public class IOnDismissSurveyCallback : Java.Lang.Object, IOnDismissCallback
{
  public void OnDismiss()
  {
    Android.Util.Log.Warn("PreShowingSurvey", "Pre Showing survey");
  }
}

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 4.8.2 & 7.11.2 (Android & iOS respectively) 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 4.8.2 & 7.11.2 (Android & iOS respectively) 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 4.8.2 & 7.11.2 (Android & iOS respectively), 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 4.8.2 & 7.11.2 (Android & iOS respectively) and above.