OneTrust Consent Management for iOS

Integrate the RudderStack iOS SDK with OneTrust.

The RudderStack iOS SDK lets you specify the user’s consent during initialization.

info
The RudderStack iOS SDK supports OneTrust consent management from version 1.9.0.

This guide lists the steps to develop a consent interceptor for the iOS SDK and use the interceptor to initialize the SDK once the user gives their consent.

Overview

The consent management is designed to be a filter for the event destinations and the natively added factories. Since the SDK initializes the native integration factories during the startup, you must capture the user’s consent to the cookie categories by then.

warning
You can add only one consent filter to the iOS SDK.

For filtering, RudderStack uses the getConsentStatus(forCategory categoryId: String) method from the OneTrust SDK.

This setup assumes the iOS SDK and the OneTrust SDK are already added to your application.

  1. Install RudderOneTrustConsentFilter by adding the following line to your Podfile:
pod 'RudderOneTrustConsentFilter', '~> 1.0.0'
  1. Import the iOS SDK:
  1. Finally, add the imports to your AppDelegate file under the didFinishLaunchingWithOptions method, as shown:
warning
Make sure you load the SDK only if the user provides their consent.

You can register CustomConsentFilter with the iOS SDK during its initialization, as shown:

Additional settings for cloud mode

info
RudderStack supports OneTrust integration in cloud mode from iOS SDK v1.12.0 onwards and RudderOneTrustConsentFilter 1.1.0.

You can specify your OneTrust cookie categories when sending events from your iOS source via the cloud mode. Follow these steps:

  1. Set up your iOS source in the RudderStack dashboard.
  2. Connect it to a new or existing destination.
  3. In the destination’s connection settings, enter the OneTrust category ID in the Category ID field:
OneTrust category ID in consent settings
warning

When sending events via the cloud mode, make sure you enter the category ID corresponding to the OneTrust cookie category. Specifying the category name will not work.

You can find the category IDs in your OneTrust dashboard under Preference & Consent Management > Cookie Compliance > Categorizations > Categories.


Questions? Contact us by email or on Slack