Last modified January 14, 2021 by Shelly Wolfe

How do I target users based on their in-app preferences?

At times, you may want to send different kinds of push notifications to your users depending on their in-app notification settings. You can often group notifications into specific categories, as the following examples show.

A banking app may have different types of notifications:

  • Statement-related notifications, such as informing users of a low balance or notifying users their monthly statement is available.
  • Marketing notifications, such as informing users about new features or that they qualify for a bank loan or line of credit.
  • Security notifications, such as informing users they need to update their password or there’s been a fraud detection on their account.

A simple news app may allow users to subscribe to certain categories of news:

  • Local news
  • Weather
  • Finance
  • Politics

Swrve lets you enforce these categories and ensure that users only receive the notifications they have requested.

There are two main steps involved in managing user preference-based notifications:

  1. Configuring your app to send user notification settings to Swrve.
  2. Targeting users in your campaigns based on their notification settings.

Configuring your app to send notification settings

To configure your app to send notification settings to Swrve, first integrate the Swrve SDK, including push notifications (for more information, see the platform-related SDK integration guide). Ensure you choose a meaningful location to prompt users to agree to push notifications.

For a simple solution on iOS (where users must agree to push before Swrve can receive a device’s push token), use a Swrve Conversation to request push notification permission and explain what the notifications are used for. (For more information on creating a Conversation campaign, see Creating Conversations.) In the campaign workflow, select the Push Opt-In template and edit the Conversation as needed:

Select Conversation template

The Push Opt-In Conversations template is only available for iOS. To create a simple Android version of an opt-in campaign, use an in-app message to display your opt-in request. Then, as an audience filter for your push notification campaign, only target users who have clicked this message to give permission to receive push notifications:

Target push opt in campaign

Once a user gives permission to receive push notifications, you can gather more detail on the type of notifications the user is interested in receiving using the app’s built-in settings page. Many apps have a notification settings menu that controls communication preferences by category (for example, likes, comments, contact updates, follow requests, direct messages). For each category, send a custom user property to Swrve. See the examples code snippets below.

iOS

[SwrveSDK userUpdate:@{
    @"Push_LocalNews": @"true",
    @"Push_Sports": @"true",
}];

Android

Map<String, String> attributes = new HashMap<String, String>();
attributes.put("Push_LocalNews", "true");
attributes.put("Push_Sports", "true");
SwrveSDK.userUpdate(attributes);

Targeting users by notification settings

After your development team implements category-based custom user properties, you can then use them in your campaigns to target specific groups by their preference type. On the Set Target screen of the campaign workflow, under Define Target Audience, select the desired property and enter a value of true.

Targeting push notification settings property

For any ongoing campaigns, you can select the desired notification category user property to ensure you’re targeting the right users for marketing.