- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
How do I add IDFA to my mobile Data Layer?
The following is example code for adding an app's IDFA string to the Data Layer.
Learn more about ASIdentifierManager.
// Objective-C
// 1. Place into a helper class that calls Tealium
// 2. Add import statement at the top of the class with other imports - DON'T FORGET to
// add the AdSupport.framework in your project's target build.
@import AdSupport;
// 3. Add this class function
+ (NSString*) identifierForAdvertising {
if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]){
NSUUID *idfa = [[ASIdentifierManager sharedManager] advertisingIdentifier];
return [idfa UUIDString];
}
return nil;
}
// 4. Example Tealium initialization & adding the IDFA as a persistent data point.
+ (void) startTealium {
TEALConfiguration *config = [TEALConfiguration configurationWithAccount:@"(account)" profile:@"(profile)" environment:@"(environment)"];
Tealium *tealium = [Tealium newInstanceForKey:@"(uniqueId)" configuration:config];
// Alternatively just add the following 2 lines to wherever a Tealium instance is
// already initialized.
NSString *idfa = [self identifierForAdvertising];
[tealium addPersistentDataSources:@{@"idfa":idfa}];
}
Copyright All Rights Reserved © 2008-2023