Set up App Tracking Transparency

Note:
The App Tracking Transparency framework is only available on iOS devices with Adjust SDK v4.26.0 or later.

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 the Adjust backend with each request.

Authorization statuses

App-tracking authorization wrapper

The Adjust SDK contains a wrapper around Apple's requestTrackingAuthorizationWithCompletionHandler method. You can use this wrapper if you do not 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 the Adjust backend. You can define responses to each status code within the callback function.

You must specify text content for the tracking request dialog. You can add this to your project in two ways:

  1. Add your text to the User Tracking Description field in the Adjust prefab.
  2. Add your text to the NSUserTrackingUsageDescription key in your Info.plist file.
Tip:
The Adjust SDK also records the consent status if you use a custom prompt. If you show your prompt before initialization, the SDK sends the status with the install event. If you show it after initialization, the SDK sends the status to the backend as soon as the user updates it.
C#
Adjust.requestTrackingAuthorizationWithCompletionHandler((status) =>
{
    switch (status)
    {
        case 0:
            // ATTrackingManagerAuthorizationStatusNotDetermined case
            break;
        case 1:
            // ATTrackingManagerAuthorizationStatusRestricted case
            break;
        case 2:
            // ATTrackingManagerAuthorizationStatusDenied case
            break;
        case 3:
            // ATTrackingManagerAuthorizationStatusAuthorized case
            break;
    }
});

Example

Get current authorisation status

You can retrieve a user's current authorization status at any time. Call the getAppTrackingAuthorizationStatus method to return the authorization status code as an integer.

C#
Adjust.getAppTrackingAuthorizationStatus();

Example

Check for authorization status changes

If you use a custom ATT prompt, you need to inform the Adjust SDK of changes to the user's authorization status. Call the checkForNewAttStatus method to send the authorization status to the Adjust backend.

C#
Adjust.checkForNewAttStatus();

Custom 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 set the attConsentWaitingInterval property to delay the sending of data for up to 120 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.

Note:
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.
C#
AdjustConfig config = new AdjustConfig("{YourAppToken}", AdjustEnvironment.Sandbox, true);
config.setAttConsentWaitingInterval(6);
Adjust.start(config);