adjust-icon

Set up App Tracking Transparency

If you want to record the device's ID for Advertisers (IDFA), you must display a prompt to get your user's authorization. To do this, you need to include Apple's App Tracking Transparency (ATT) framework in your app. The Adjust SDK stores the user's authorization status and sends it to Adjust's servers with each request.

Authorization statuses

StatusCodeDescription
ATTrackingManagerAuthorizationStatusNotDetermined0The user hasn't responded to the access prompt yet
ATTrackingManagerAuthorizationStatusRestricted1Access to app-related data is blocked at the device level
ATTrackingManagerAuthorizationStatusDenied2The user has denied access to app-related data for device measurement
ATTrackingManagerAuthorizationStatusAuthorized3The user has approved access to app-related data for device measurement

If the SDK is unable to retrieve the ATT status, it returns a value of -1.

The Adjust SDK contains a wrapper around Apple's requestTrackingAuthorizationWithCompletionHandler method. You can use this wrapper if you don't want to customize the ATT prompt.

The callback method triggers when your user responds to the consent dialog. This method sends the user's consent status code to Adjust's servers. You can define responses to each status code within the callback function.

You must specify text content for the tracking request dialog. To do this, add your text to the NSUserTrackingUsageDescription key in your Info.plist file.

Adjust2dx::requestAppTrackingAuthorization([] (int status) {
switch (status) {
case 0:
// ATTrackingManagerAuthorizationStatusNotDetermined case
break;
case 1:
// ATTrackingManagerAuthorizationStatusRestricted case
break;
case 2:
// ATTrackingManagerAuthorizationStatusDenied case
break;
case 3:
// ATTrackingManagerAuthorizationStatusAuthorized case
break;
}
});

Customize prompt timing

If your app includes an onboarding process or a tutorial, you may want to delay sending your user's ATT consent status until after the user has completed this process. To do this, you can call the setAttConsentWaitingInterval method on your AdjustConfig2dx instance to delay the sending of data for up to 360 seconds to give the user time to complete the initial onboarding. After the timeout ends or the user sets their consent status, the SDK sends all information it has recorded during the delay to Adjust's servers along with the user's consent status.

If the user closes the app before the timeout ends, or before they select their consent status, the timeout restarts when they reopen the app.

AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment);
adjustConfig.setAttConsentWaitingInterval(30);
Adjust2dx::initSdk(adjustConfig);

Get current authorization status

You can retrieve a user's current authorization status at any time. Call the Adjust2dx::getAppTrackingAuthorizationStatus() method to return the authorization status code as an int.

Adjust2dx::getAppTrackingAuthorizationStatus();