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, include Apple’s ATT framework in your app. The Adjust SDK stores the user’s authorization status and sends it to Adjust’s servers with every 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

ATT authorization wrapper

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 the user responds to the consent dialog. This method sends the user’s consent status code to Adjust’s servers. You can define how your app responds to each status code within the callback function.

You must provide text content for the ATT request dialog by adding your message to the NSUserTrackingUsageDescription key in your app’s Info.plist file.

local adjust = require "plugin.adjust"
adjust.requestAppTrackingAuthorization(function(status)
if status.message == 0 then
-- ATTrackingManagerAuthorizationStatusNotDetermined case
elseif status.message == 1 then
-- ATTrackingManagerAuthorizationStatusRestricted case
elseif status.message == 2 then
-- ATTrackingManagerAuthorizationStatusDenied case
elseif status.message == 3 then
-- ATTrackingManagerAuthorizationStatusAuthorized case
else
-- error case
end
end)

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.

local adjust = require "plugin.adjust"
adjust.getAppTrackingAuthorizationStatus(function(status)
print("Authorization status: " .. status.message)
end)

Custom prompt timing

If your app includes onboarding steps or a tutorial, you may want to delay sending the user’s ATT consent status until after this process. You can do this by setting the attConsentWaitingInterval key in your configuration table. This delays sending data for up to 360 seconds, giving the user time to finish onboarding. Once the timeout ends, or as soon as the user sets their consent status, the SDK sends all recorded information to Adjust’s servers along with the consent status.

local adjust = require "plugin.adjust"
adjust.initSdk({
appToken = "YourAppToken",
environment = "SANDBOX",
logLevel = "VERBOSE",
attConsentWaitingInterval = 30
})

Disable the usage of App Tracking Transparency

If you want to prevent the Adjust SDK from automatically interacting with AppTrackingTransparency.framework, set the isAppTrackingTransparencyUsageEnabled key in your configuration table to false before SDK initialization.

local adjust = require "plugin.adjust"
adjust.initSdk({
appToken = "YourAppToken",
environment = "SANDBOX",
logLevel = "VERBOSE",
isAppTrackingTransparencyUsageEnabled = false
})