HomeDocumentationAPI Reference
Getting StartedAPI ReferenceBug ReportingCrash ReportingAPMHelp Center
These docs are for v8.1. Click to read the latest docs for v12.0.0.

Targeting Surveys

Detailed here is how you can target specific users for your In-App Surveys as well as related APIs.

You can define criteria that your users have to meet in order for your surveys to appear in their app. This can be done through both automatic and manual targeting.

Auto Targeting Surveys

After choosing the survey type you want to create, you can target specific audiences using custom conditions.

When you select Auto Targeting, you can define criteria for who should receive the survey. Your users matching the conditions you set will automatically see the survey. In addition to default attributes like app version, you can set conditions for custom user attributes or user events that you have created.

2169

This is the audience targeting step of the survey creation flow in your dashboard, with Auto Targeting selected.

Controlling Auto Targeting

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

Showing Automatically

By default, a survey will automatically be presented to users who meet your conditions in their first session after you publish the survey within 10 seconds of opening your app. If you have multiple surveys running and a user meets the conditions for more than one survey, they will be shown each survey one by one.

Showing Manually

You can also customize when you want to show your auto targeting surveys. To do this, first disable automatic showing using the following API.

Surveys.autoShowingEnabled = false
IBGSurveys.autoShowingEnabled = NO;

Then, present the surveys using the below APIs.

// Optionally, use the API below if you'd like to check if there are any surveys that are ready to be presented. You can do things like ask the user if they'd like to take a survey.
let surveys = Surveys.availableSurveys

let hasSurveys = false

if surveys.count > 0 {
		hasSurveys = true
    surveys.first.show()
}

//Alternatively, you can also use the following method to show available surveys
Surveys.showSurveyIfAvailable()
// You can use the API below if you'd like to check if there are any surveys that are ready to be presented. You can do things like ask the user if they'd like to take a survey.
NSArray<IBGSurvey *> *surveys = [IBGSurveys availableSurveys];

BOOL hasSurveys = NO;

if (surveys.count > 0) {
		hasSurveys = YES;
    [surveys.first show];
}

//Alternatively, you can also use the following method to show available surveys
[IBGSurveys showSurveyIfAvailable];

Auto targeting surveys can only be shown a maximum of two times. Learn how to set the conditions for re-showing dismissed surveys here.

Manual Targeting Surveys

You can also use Manual Targeting to show your surveys to specific audiences, and these surveys can be re-shown any number of times.

Each created survey has a unique token that you can refer to in your code, as explained in the following section.

2169

This is the audience targeting step of the survey creation flow in your dashboard, with Manual Targeting selected.

Controlling Manual Targeting Surveys

When you want to target your surveys to specific users, like only users who opt-in, manually targeted surveys might be the best method. You can use the following API to show a survey with a specific token.

Surveys.showSurvey(withToken: "TOKEN")
[IBGSurveys showSurveyWithToken:@"TOKEN"];

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

let hasResponded = Surveys.hasRespondedToSurvey(withToken: "TOKEN")
BOOL hasResponded = [IBGSurveys hasRespondedToSurveyWithToken:@"TOKEN"];

The above API is particularly useful since you can manually show a survey multiple times to the same user. More information can be found here regarding re-showing surveys.


What’s Next

Now that you've learned how to target your users, check out how to customize behavioral elements of your surveys.