• Platforms
  • Partners
  • Forums
  • TLC Tealium Learning Center Tealium Learning
    Community
  • Discussions & Ideas Dicussions & Ideas
  • Product Guides Product Guides
  • Knowledge Base Knowledge Base
  • Developer Docs Developer Docs
  • Education Education
  • TLC Blog TLC Blog
  • Support Desk Support Desk
  • CDH Customer Data Hub Customer Data Hub

Table of Contents

  • Usage
  • Sample Apps
  • Data Layer
  • Use Cases
    • Use Case: Simple Opt-in
    • Use Case: Grouped Opt-in
    • Use Case: Category-based Opt-in
  • API Reference
    • consentManager
    • TEALConfiguration
    • TEALConsentManagerDelegate
  • Consent Categories
  • TEALConsentStatus
IOS OBJECTIVE C

Consent Management

Learn to implement Consent Management for iOS (Objective-C).

Usage

Usage of this module is recommended, as it is automatically included and enabled in the CocoaPods framework builds.

Supported platforms include: iOS, macOS, tvOS, and watchOS.

Learn more about Consent Management.

Sample Apps

To help familiarize yourself with enabling Tealium Consent Management, it is recommended to download the sample apps:

  • Objective-C Sample App
  • Swift Sample App

Data Layer

The following variables are transmitted with each tracking call while Consent Management is enabled:

Variable Name Description Example
policy The policy under which consent was collected (Default: gdpr) gdpr
consent_status The user’s current consent status ["Consented", "Not Consented"]
consent_categories The user’s current categories they are consented to @[@"analytics"]

Use Cases

Use Case: Simple Opt-in

[_tealium.consentManager setUserConsentStatus:Consented];

This example shows you how to give your users a simple “Opt-in/Opt-out” option. If the user consents, they are automatically opted-in to all tracking categories. If they revoke their consent, no categories are active, and no tracking calls are sent.

Define and call the following method in your Tealium Helper class when your app user consents to or declines tracking. If the user consents to tracking, the Consent Manager automatically opts them in to all tracking categories.

consent-simple-optin.gif 

Use Case: Grouped Opt-in

[_tealium.consentManager setUserConsentStatus:Consented withUserConsentCategories:@[@"analytics", @"monitoring", @"big_data", @"mobile", @"crm"]];

This example shows a category-based consent model, where tracking categories are grouped into a smaller number of higher-level categories, defined by you. For example, you may choose to group the Tealium consent categories "analytics", "monitoring", "big_data", "mobile", and "crm" under a single category called "performance". This may be easier for the user than selecting from the full list of categories. You may choose to represent this in a slider interface, ranging from least-permissive to most-permissive (all categories).

 consent-group-optin.gif

Use Case: Category-based Opt-in

[_tealium.consentManager setUserConsentStatus:Consented withUserConsentCategories:@[@"analytics", @"personalization"]];

This example shows a category-based consent model where the user must explicitly select each category from the full list of categories. The default state of the Consent Manager is "Unknown", which queues hits until the user provides their consent. If the user consents to any category, events are dequeued, and the consented category data is appended to each tracking call.

 consent-category-optin.gif

API Reference

consentManager

This code shows how to enable Consent Management on Tealium initialization.

// TealiumHelper.h

@import TealiumIOS;
@interface TealiumHelper : NSObject<TealiumDelegate, TEALConsentManagerDelegate>
@property (nonatomic, strong) Tealium *tealium;
@end

// TealiumHelper.m

@implementation TealiumHelper

+ (instancetype _Nonnull)sharedInstance {
  static TealiumHelper *tealiumHelper = nil;
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
  tealiumHelper = [[self alloc] init];
  });

  return tealiumHelper;
}

- (instancetype)init {
  if (self = [super init]) {
    TEALConfiguration *configuration = [TEALConfiguration configurationWithAccount:@"ACCOUNT" profile:@"PROFILE" environment:@"ENVIRONMENT"];
    [configuration setLogLevel: TEALLogLevelDev];

    // enable Tealium Consent Manager
    [configuration setEnableConsentManager:YES];

    _tealium = [Tealium newInstanceForKey:@"INSTANCE" configuration:configuration];
    _tealium.delegate = self;

    // set optional Tealium Consent Manager Delegate
    _tealium.consentManagerDelegate = self;
    NSLog(@"%s, %@", __FUNCTION__, [TEALConsentManager consentStatusString:_tealium.consentManager.userConsentStatus]);
  }

  return self;
}

@end

enable
Enable Consent Manager. This method enables Consent Manager at a later time and not on Tealium initialization.

[_tealium.consentManager enable];

The recommended approach is to enable Consent Manager on Tealium initialization.  

isEnabled
Checks if Consent Manager is enabled.

[_tealium.consentManager isEnabled];

disable
Disables Consent Manager. This method disables Consent Manager after Tealium is fully initialized.

[_tealium.consentManager disable];

isDisabled
Checks if the Consent Manager is disabled.

[_tealium.consentManager isDisabled];

consentManagerDelegate
Registers a specific class conforming to the TEALConsentManagerDelegate protocol.

[_tealium setConsentManagerDelegate:(id<TEALConsentManagerDelegate>)];

setUserConsentStatus
Sets the user’s consent status. Designed to be called from your consent management preferences screen in your app when the user enables or disables tracking.

[_tealium.consentManager setUserConsentStatus:Consented];

Consent Manager always sets the list of consented categories to include ALL available consent categories if the status is Consented. This method does not allow categories to be set selectively.  

Parameters Description Example
TEALConsentStatus A value from TEALConsentStatus enum [Consented, NotConsented, Disabled]

setUserConsentCategories
Sets the user’s consent categories. Designed to be called from your consent management preferences screen in your app.

[_tealium.consentManager setUserConsentCategories:@[@"analytics"]];

Always sets consent status to Consented when any number of categories are set.

Parameters Description Example
NSArray An array of predefined NSString categories @[@"analytics", @"big_data"]

setUserConsentStatus:withUserConsentCategories
Sets the user’s consent status and user’s consent categories in a single method.

[_tealium.consentManager setUserConsentStatus:Consented withUserConsentCategories:@[@"analytics"]];
Parameters Description Example Value
TEALConsentStatus A value from TEALConsentStatus enum [Consented, NotConsented]
NSArray An array of predefined NSString categories @[@"analytics", @"big_data"]

userConsentStatus
Returns the current consent status of the user.

[_tealium.consentManager userConsentStatus];

userConsentCategories
Returns the current consent categories of the user.

[_tealium.consentManager userConsentCategories];

isConsented
Convenience method to determine if the user is consented.

[_tealium.consentManager isConsented];

consentStatusString
Convenience method for human-readable string of the TEALConsentStatus enum.

[TEALConsentManager consentStatusString:_tealium.consentManager.userConsentStatus];

resetUserConsentPreferences
Resets all currently stored consent preferences. Reverts to Unknown consent status with no categories.

[_tealium.consentManager resetUserConsentPreferences];

setConsentLoggingEnabled
Enables the Consent Logging feature, which sends all consent status changes to Tealium Customer Data Hub for auditing purposes.

[_tealium.consentManager setConsentLoggingEnabled:YES];
Parameters Description Example Value
TEALConsentLoggingEnabled Enables or disables consent logging [YES, NO]

isConsentLoggingEnabled
Returns the current state of the consent logging feature.

[_tealium.consentManager isConsentLoggingEnabled];

allCategories
Returns the complete list of supported consent categories.

[_tealium.consentManager allCategories];

TEALConfiguration

enableConsentManager
Sets the initial consent status for the user when the library starts up for the first time. If there are saved preferences, they override any preferences passed in the config object.

self.configuration.enableConsentManager = YES;

Consent Manager always sets the list of consented categories to include ALL available consent categories, if the status is Consented. This method does not allow categories to be set selectively.

userConsentStatus
Sets the user’s initial consent status when the library starts up for the first time. If there are saved preferences, these override any preferences passed in the config object.

self.configuration.userConsentStatus = Consented;
Parameters Description Example Value
TEALConsentStatus A value from TEALConsentStatus enum [Consented, NotConsented, Disabled]

userConsentCategories
Sets the user’s initial consent categories when the library starts up for the first time. If there are saved preferences, these override any preferences passed in the config object.

self.configuration.userConsentCategories = @[@"analytics", @"retargeting"];
Parameters Description Example Value
NSArray An array of predefined NSString categories @[@"analytics", @"big_data"]

TEALConsentManagerDelegate

consentManagerDidChangeWithState
This method is called whenever the Consent Manager user consent status is changed. For example, the user consented or declined tracking.

- (void)consentManagerDidChangeWithState:(TEALConsentStatus)consentStatus;

consentManagerDidUpdateConsentCategories
This method is called whenever the Consent Manager user consent categories are updated.

-(void)consentManagerDidUpdateConsentCategories:(NSArray * \_Nullable)categories;

consentManagerWillDropDispatch
This method is called whenever the Consent Manager is going to drop a tracking call. For example, the user declined tracking.

- (void)consentManagerWillDropDispatch:(TEALDispatch * \_Nullable)dispatch;

consentManagerWillQueueDispatch
This method is called whenever the Consent Manager is in the Unknown state. Tracking calls are being queued locally until the user grants or declines consent.

- (void)consentManagerWillQueueDispatch:(TEALDispatch * \_Nullable)dispatch;

Consent Categories

The following lists all the supported consent categories:

  • analytics
  • affiliates
  • display_ads
  • email
  • personalization
  • search
  • social
  • big_data
  • mobile
  • engagement
  • monitoring
  • cdm
  • cdp
  • cookiematch
  • misc

TEALConsentStatus

Unknown
The Unknown status is the default setting for the Consent Manager. In this state, the Consent Manager queues events locally until an affirmative Consented / NotConsented status is provided.

self.tealium.consentManager.userConsentStatus = Unknown

Consented
The Consented status is set when the user has consented to tracking. In this state, the Consent Manager allows all tracking calls to continue as normal.

self.tealium.consentManager.userConsentStatus = Consented

NotConsented
The NotConsented status is set when the user has declined tracking. In this state, the Consent Manager drops all tracking calls and halt further processing by the SDK.

self.tealium.consentManager.userConsentStatus = NotConsented
Data Management
Tag Management

 
  • Mobile
  • Getting Started
    • Overview
    • Quick Start Guide
    • Mobile Concepts
    • Client-Side
    • Server-Side
    • Tracking Webviews
    • Data Layer
    • Consent Management
    • Event Batching
    • User Location and Geofencing
    • Deep Links
    • Timed Events
    • Trace
    • Hosted Data Layer
    • Feature Comparison
    • Troubleshooting
  • Remote Commands
    • Overview
    • How It Works
    • Integrations
      • AppsFlyer
      • Braze
      • Contentsquare
      • Facebook
      • Firebase
      • Kochava
      • Usabilla
  • Android (Java)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Module
      • Optimizely X Tracking Module
    • Android TV
    • Android Wear
    • API Reference
      • ConsentManager
      • DataSources
      • Lifecycle
      • Tealium
      • Tealium.Config
      • TealiumLocation
    • Release Notes
  • Android (Kotlin)
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • Identity Resolution
    • Module List
      • Ad Identifier Module
      • Collect Module
      • Collectors Module
      • Crash Reporter Module
      • Install Referrer Module
      • Lifecycle Tracking Module
      • Location Manager Module
      • RemoteCommands Module
      • Tag Management Dispatcher Module
      • Visitor Service Module
    • Android TV
    • API Reference
      • ConsentCategory
      • ConsentManager
      • CurrentVisit
      • DataLayer
      • Lifecycle
      • LocationManager
      • Tealium
      • TealiumConfig
      • VisitorProfile
      • VisitorService
    • Release Notes
  • Cordova
    • Overview
    • Install
    • Track
    • Data Management
    • Module List
      • Ad Identifier Module
      • Crash Reporter Module
      • Install Referrer Module
    • API Reference
    • Release Notes
  • Flutter
    • Overview
    • Install
    • Track
    • Consent Management
    • Data Management
    • API Reference
    • Release Notes
  • iOS (Objective-C)
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • Consent Management
    • Tag Management
    • Module List
      • Lifecycle Tracking Module
    • tvOS
    • watchOS
    • API Reference
    • Release Notes
  • iOS (Swift) 1.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Data Management
    • App Extensions
    • Identity Resolution
    • Consent Management
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DataSource Module
      • DefaultStorage Module
      • Delegate Module
      • DeviceData Module
      • DispatchQueue Module
      • FileStorage Module
      • Lifecycle Module
      • Location Module
      • Logger Module
      • PersistentData Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
      • VolatileData Module
    • Feature Comparison
    • Working with Objective-C
    • API Reference
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManagerDelegate
      • TealiumConsentManager
      • TealiumInstanceManager
      • TealiumPersistentData
      • TealiumVolatileData
      • Tealium
    • Release Notes
  • iOS (Swift) 2.x
    • Overview
    • Install
    • Track
    • Data Layer
    • Consent Management
    • App Extensions
    • Identity Resolution
    • Modules
    • Module List
      • AppData Module
      • Attribution Module
      • AutoTracking Module
      • Collect Module
      • Connectivity Module
      • CrashReporter Module
      • DeviceData Module
      • Lifecycle Module
      • Location Module
      • RemoteCommands Module
      • TagManagement Module
      • VisitorService Module
    • Working with Objective-C
    • API Reference
      • Tealium
      • TealiumConfig
      • TealiumConsentCategories
      • TealiumConsentManager
      • TealiumDataLayer
      • TealiumInstanceManager
    • Release Notes
  • NativeScript
    • Overview
    • Install
    • Track
    • API Reference
      • Tealium
      • TealiumConfig
    • Release Notes
  • React Native 1.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • React Native 2.x
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Unity
    • Overview
    • Install
    • Track
    • API Referencee
  • Xamarin
    • Overview
    • Install
    • Track
    • Data Management
    • Consent Management
    • API Reference
    • Release Notes
  • Web
  • Getting Started
    • Overview
    • Quick Start Guide
    • Web Concepts
  • Adobe Launch
    • Overview
    • Install
    • Data Layer
  • AMP
    • Install
    • Track
    • Data Layer
    • Overview
  • Angular
    • Install
    • Track
    • API Reference
    • Overview
  • Google Tag Manager
    • Overview
    • Data Layer
    • Install
  • JavaScript (Web)
    • Install
    • Track
    • Data Layer
    • Overview
    • Universal Data Object (utag_data)
    • Universal Tag (utag.js)
    • Data Layer Object (b)
    • Single-Page Applications
    • Settings
    • Debugging
    • API Reference
      • Cookie Functions
      • GDPR Functions
      • Tracking Functions
      • Utility Functions
    • Release Notes
  • Server
  • C#
    • Overview
    • Install
    • Track
    • Data Layer
    • API Reference
    • Release Notes
  • HTTP API
    • Overview
    • Endpoint
    • Data Layer
  • Java
    • Overview
    • Install
    • Track
    • API Reference
    • Release Notes
  • Node
    • Overview
    • Install
    • Track
    • API Reference
  • Python
    • Overview
    • Install
    • Track
    • API Reference
  • Roku
    • Overview
    • Install
    • Track
    • API Reference
  • Ruby
    • Overview
    • Install
    • Track
    • API Reference

Was this article helpful?

This page was last updated: January 23, 2020       Thank you for your feedback!
  • Platforms
  • Partners
  • Forums
  • Mobile
  • Getting Started
  • Remote Commands
  • Android (Java)
  • Android (Kotlin)
  • Cordova
  • Flutter
  • iOS (Objective-C)
  • iOS (Swift) 1.x
  • iOS (Swift) 2.x
  • NativeScript
  • React Native 1.x
  • React Native 2.x
  • Unity
  • Xamarin
  • Web
  • Getting Started
  • Adobe Launch
  • AMP
  • Angular
  • Google Tag Manager
  • JavaScript (Web)
  • Server
  • C#
  • HTTP API
  • Java
  • Node
  • Python
  • Roku
  • Ruby