Today we’re happy to announce that starting with version 2.1 of our iOS SDK we’ve added support for the Apple IDFA.

What is an IDFA?

The Advertising Identifier (IDFA) is a unique ID for each iOS device that mobile ad networks typically use to serve targeted ads. Users can choose to limit ad tracking by turning off this setting on their devices.

How to use the IDFA?

To access the IDFA you need to import the AdSupport framework in your target application, read the IDFA from the iOS device and pass that on to the SDK. The IDFA is then synchronized with the Sensorberg Portal.

#import <AdSupport/AdSupport.h>
// Check if Advertising Tracking is Enabled  
if([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled])  
{  
	NSUUID *IDFA = [[ASIdentifierManager sharedManager] advertisingIdentifier];  
	if (IDFA) {  
		[[SBManager sharedManager] setIDFAValue:IDFA.UUIDString];  
	}  
}  

or in Swift

import AdSupport  
// Check if Advertising Tracking is Enabled  
if ASIdentifierManager.sharedManager().advertisingTrackingEnabled {  
	let IDFA:String = ASIdentifierManager.sharedManager().advertisingIdentifier.UUIDString  
	SBManager.sharedManager().setIDFAValue(IDFA)  
}   

Important

Because of the very specific use-case, we chose not to include the AdSupport framework in the SDK as improper use might trigger a rejection when submitting your app.
Also keep in mind that some users have enabled the Limit Ad Tracking feature which means that the IDFA will not be available. In this case, you can simply pass any arbitrary string (the user id, a generated UUID etc).