Advertiser Tracking Enabled

This guide shows you how to enable and disable advertising tracking.

Starting with iOS 14, you will need to set AdvertiserTrackingEnabled and log each time you give a device permission to share data with Facebook.

Use the Advertiser Tracking Enabled parameter to indicate whether we should use event data for ads in line with your own legal obligations, platform terms and commitments you’ve made to your users.

Limitations

  • AdvertiserTrackingEnabled is only available for iOS 14+.
  • For all version prior to iOS 14, iOS 13 or earlier, Limit Ad Tracking is used.

Get Device Consent

If a device provides consent, call the setAdvertiserTrackingEnabled method of the FBSDKSettings class and set it to YES for Objective-C or true for Swift. If a device does not allow tracking, set setAdvertiserTrackingEnabled to NO for Objective-C or false for Swift. The method will return a boolean value to indicate whether the method is set successfully or not.

Allow Advertiser Tracking


// Set AdvertiserTrackingEnabled to YES if a device provides consent
[FBSDKSettings setAdvertiserTrackingEnabled:YES];
// Set AdvertiserTrackingEnabled to true if a device provides consent
Settings.setAdvertiserTrackingEnabled(true)
// Set AdvertiserTrackingEnabled to true if a device provides consent
FB.Mobile.SetAdvertiserTrackingEnabled(true)

Do Not Allow Advertiser Tracking


// Set AdvertiserTrackingEnabled to NO if a device does not provide consent
[FBSDKSettings setAdvertiserTrackingEnabled:NO];
// Set AdvertiserTrackingEnabled to false if a device does not provide consent
Settings.setAdvertiserTrackingEnabled(false)
// Set AdvertiserTrackingEnabled to false if a device does not provide consent
FB.Mobile.SetAdvertiserTrackingEnabled(false)

After a user assents to advertiser tracking and you enable events, be sure to initialize the SDK before sending events.