App Tracking Transparency
Starting in iOS 14.5, IDFA will be unavailable until an app calls the App Tracking Transparency framework to present the app-tracking authorization request to the end-user. If an app does not present this request, the IDFA will automatically be zeroed out, which may lead to a significant loss in ad revenue.
To display the App Tracking Transparency authorization request for
accessing the IDFA, update your Info.plist
to add the
NSUserTrackingUsageDescription
key with a custom message describing
the usage.
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
And AppTrackingTransparency.framework to your project.
1. Stack Consent Manager
If you are using StackConsentManager framework in your project, no
additional steps are required. Authorization request will be shown for
users under iOS 14.5 and higher after
-[STKConsentManager showConsentDialogFromRootViewController:delegate:]
method
is invoked.
No additional steps are needed. Consent Manager integration remains the same as in the GDPR/CCPA section.
Consent Manager will show ATT request only for users under iOS 14.5 or higher, you may want to add some notes in App Review Information section of the app version page in App Store Connect. For example, it can be something like: App Tracking Transparency request is only available for users under iOS 14.5 or higher. This step may be needed because Apple can reject builds that contain AppTrackingTransparency.framework, but do not display ATT requests at app launch.
2. Manually
If you are using StackConsentManager framework in your project but want to present App Tracking Transparency request alert by yourself you need to disable Consent Manager ATT logic:
- Swift
- Objective-C
class YourAppDelegate: AppDelegate {
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool {
STKConsentManager.shared().disableAppTrackingTransparencyRequest()
STKConsentManager.shared().synchronize(withAppKey: "Your app key") { error in
guard let error = error else { return }
print("Error occurred during synchronization: \(error)")
}
return true
}
}
@implementation YourAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[STKConsentManager.sharedManager disableAppTrackingTransparencyRequest];
[STKConsentManager.sharedManager synchronizeWithAppKey:APP_KEY completion:^(NSError *error) {
if (error) {
NSLog(@"Error occurred during synchronization %@", error);
}
}];
}
Call requestTrackingAuthorizationWithCompletionHandler:
to present the
App Tracking Transparency authorization request alert. Call this method
at the application launch event. We recommend initializing Appodeal SDK
in the completion block.
- Swift
- Objective-C
import AppTrackingTransparency
import AdSupport
class AppDelegate : UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
ATTrackingManager.requestTrackingAuthorization() { status in
// Tracking authorization completed. Initialise Appodeal here.
}
return true
}
}
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import <AdSupport/AdSupport.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
// Tracking authorization completed. Initialise Appodeal here.
}];
return YES;
}