- iOS 13 and below: the SDK collects the IDFA automatically, provided advertising tracking is enabled on the device. No extra integration is required.
- iOS 14 and later: Apple’s App Tracking Transparency framework requires explicit user permission. Your app requests this permission and passes the result to the SDK using one of the two methods below.
PrerequisiteTo request tracking authorization on iOS 14+, add the
NSUserTrackingUsageDescription key to your app’s
Info.plist with a short, user-facing explanation of why you request access. Apple displays this string in the
native ATT prompt.Method A: setAdvertisingIdByATTStatus
Pass the ATT authorization status to the SDK and let the SDK retrieve the IDFA from the device for you.
Syntax
Parameters
Behavior
- When
status == .authorized, the SDK reads the IDFA fromASIdentifierManagerand adds bothadvertising_idandatt_authorization_statusto the user payload. - For any other status (
.denied,.notDetermined,.restricted), the SDK adds onlyatt_authorization_status. Noadvertising_idis sent.
Example
Method B: setATTStatusAndAdvertisingId
Pass both the ATT status and the IDFA string explicitly. Use this when you manage IDFA retrieval yourself
(for example, behind a custom consent UI).
Syntax
Parameters
Behavior
The SDK stores exactly theadvertisingId you pass. Provide the IDFA only when the status is authorized;
omit it (or pass "") otherwise.
Example
Authorization status values
The SDK recordsatt_authorization_status using these string values:
The not-determined value is camelCase
notDetermined. When you build downstream segments that filter on
att_authorization_status, match these exact values.Best Practices
-
Initialize the SDK first. Call
Collect.initialize(option:)(typically inapplication(_:didFinishLaunchingWithOptions:)) before requesting tracking authorization. - Request at the right moment. Show your own context (pre-permission) screen before triggering the native ATT prompt, and avoid requesting during critical flows.
-
Add
NSUserTrackingUsageDescription. The ATT prompt will not appear without it. -
Respect the user’s choice. When the status is not
authorized, the SDK does not send anadvertising_id; continue to operate without it.
Related Documentation
- Track User Consent: Manage GDPR / CCPA consent signals.
- Consent Configuration Options: SDK options such as
optout,useConsent. - Apple — Requesting authorization to track: Official ATT reference.