Batch allows you to target your users based on push notification preferences set in the app. This is particularly useful if you are a media and you have thematic categories (ex: football, etc.) or if you want to leave the choice to the user to disable only certain alerts (ex: special offers, etc.)

1. Allow users to define their push preferences within the app

First, your users should be able to subscribe to one or more push categories within your app. This could be achieved through a dedicated screen in the account settings section of the app for instance. Below are some examples:

2. Collect the necessary data for targeting

You need to collect your users' preferred push categories and send them to Batch using one of our data collection methods (SDK methods: iOS / Android, Custom Data API).

That data should be tagged as a tag collection which is a data format that consists of an array of string values (see more here: iOS / Android ).

A user that would be subscribed to "Sports" and "Culture", for instance, would have these two values in the tag collection (push_optins = ["Sports", "Culture"]).

Note that for your targeting, to be as precise as possible, you should make sure this data is up to date by refreshing it at:

  • Every app start
  • Every time users make a change in your app preferences

3. Send notifications

To exploit the previously collected data in your push campaign targeting:

a. When creating a campaign from the dashboard

When creating a campaign on the dashboard, you can add a condition in the targeting section of the form and select the previously tagged collection in the available custom data. You can then add the different push opt-in categories that you want to target as shown below:

b. When sending a campaign through our Push Campaigns API

If you are sending your campaign via our Push Campaigns API, you will need to specify that in the targeting object of the call. To target users that are subscribed to "Sports" and "Culture", for example, you would have the following values in the targeting object:

"targeting" : 
{
"query" :
{ "t.push_optins":
{ "$contains": [ "sports", "culture" ]
}
}
}
Did this answer your question?