SDK opt-out (e.g. GDPR)

Starting with Batch 1.12, you can now opt-out from the SDK.

If you plan to send personal user data and have to comply with EU's GDPR, any other data privacy law or simply want to give your users more control regarding their privacy, these methods will help you plug your consent screen to Batch.

There are two SDK operation modes:

  • SDK enabled by default, opting-out required via an explicit method call: this is the default mode.
  • SDK disabled by default, opting-in required

Important: On iOS, disabling the SDK won't disable push notifications if Batch already has a valid token. In case you want to implement a notification opt-out, you will need to direct users to iOS' settings by using the [BatchPush openSystemNotificationSettings](Objective-C) or the BatchPush.openSystemNotificationSettings() (Swift) method.

Opting-out

In order to opt-out from SDK, simply call:

  • Swift
  • Objective-C
Batch.optOut()

Opting out will:

  • Prevent [Batch startWithAPIKey:] from starting the SDK
  • Disable any network capability from the SDK
  • Disable all In-App campaigns
  • Make the Inbox module return an error immediatly
  • Make any call to -[BatchUserDataEditor save] do nothing
  • Make any "tracking" methods from BatchUser ineffective

Even if you opt-in afterwards, data generated (such as user data or tracked events) while opted out WILL be lost.

You can also wipe the SDK installation data:

  • Swift
  • Objective-C
Batch.optOutAndWipeData()

This will wipe the data locally and request a remote data removal for the matching Installation ID and its associated data.
Any user-level data associated with the Custom User ID (if any) set via our server APIs will not be deleted. However, the Installation ID <> Custom User ID association will be, effectively logging the user out before deleting their installation data.
Sending notifications to this user using their Advertising ID (via the Transactional API or a Custom Audience) will not be possible for a month.

Note: Opting out is not possible while the SDK hasn't started. Make sure you've called [Batch startWithAPIKey:] beforehand.

Disabling the SDK by default

In order to disable the SDK by default, you need to add a key called BATCH_OPTED_OUT_BY_DEFAULT with a true boolean value to your Info.plist.

Opting-in

Once you've opted-out (either programatically, or by default), you can re-enable the SDK by calling the following:

  • Swift
  • Objective-C
Batch.optIn()
Batch.start(withAPIKey: "YOUR_API_KEY")
BatchPush.refreshToken();

Note: Even if you've already done so before opting-out, you are required to call [Batch startWithAPIKey:] or the SDK won't work until the next start.