The RudderStack iOS SDK supports OneTrust consent management in v1.9.0 and above.
The RudderStack iOS SDK lets you specify the user’s consent during initialization.
This guide lists the steps to develop a consent interceptor for the iOS SDK and use the interceptor to initialize the SDK after 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 first capture the user’s consent to the cookie categories.
You can add only one consent filter to the iOS SDK.
For filtering, RudderStack uses the getConsentStatus(forCategory categoryId: String) method of the OneTrust SDK.
Install OneTrust consent
This setup assumes the iOS SDK and the OneTrust SDK are already added to your application.
Install RudderOneTrustConsentFilter by adding the following line to your Podfile:
pod'RudderOneTrustConsentFilter','~> 1.0.0'
Import the iOS SDK:
@importRudderOneTrustConsentFilter;
importRudderOneTrustConsentFilter
Add the imports to your AppDelegate file under the didFinishLaunchingWithOptions method, as shown:
#import "CustomConsentFilter.h"
@implementationCustomConsentFilter-(NSDictionary<NSString*,NSNumber*>*__nullable)filterConsentedDestinations:(NSArray<RSServerDestination*>*)destinations{NSDictionary<NSString*,NSNumber*>*filteredConsentedDestinations;// Do someting
returnfilteredConsentedDestinations;}@end
Create a CustomConsentFilter file by extending RSConsentFilter.
@objcopenclassOneTrustInterceptor:NSObject,RSConsentFilter{@objcpublicoverrideinit(){super.init()}publicfuncfilterConsentedDestinations(_destinations:[RSServerDestination])->[String:NSNumber]?{letfilteredConsentedDestinations:[String:NSNumber]// Your codereturnfilteredConsentedDestinations}}
Register consent filter with iOS SDK
You can register CustomConsentFilter with the iOS SDK during its initialization, as shown:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.