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
Status | Code | Description |
---|---|---|
ATTrackingManagerAuthorizationStatusNotDetermined | 0 | The user hasn’t responded to the access prompt yet |
ATTrackingManagerAuthorizationStatusRestricted | 1 | Access to app-related data is blocked at the device level |
ATTrackingManagerAuthorizationStatusDenied | 2 | The user has denied access to app-related data for device measurement |
ATTrackingManagerAuthorizationStatusAuthorized | 3 | The user has approved access to app-related data for device measurement |
ATT authorization wrapper
The Adjust SDK contains a wrapper around Apple’s requestAppTrackingAuthorization
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 ATT. To do this, add your text to the NSUserTrackingUsageDescription
key in your Info.plist
file.
Example
This example shows how to log a human-readable description of the user’s authorization status when they interact with a prompt.
Get current authorization status
You can retrieve a user’s current authorization status at any time. Call the getAppTrackingAuthorizationStatus
method to return the authorization status code as a number
.
Example
This example shows how to collect the user’s authorization status and convert it to a string
. This information is assigned to a variable called authorizationStatus
and passed as a session partner parameter with the key "status"
.
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 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.