Skip to main content

Get device information

The Adtrace SDK includes helper methods that return device identifiers. Use these IDs in callbacks, server-side integrations, or internal device mapping.

MethodReturnsTypical use
adidAdtrace device ID (adid)Device mapping after install, callback placeholders, testing console
idfaiOS Identifier for Advertisers (IDFA)Cross-service deduplication, callback placeholders such as {idfa}
External device ID

To set a custom external device ID before SDK init, see Set external device ID. This page covers reading adid and IDFA.

Adtrace device identifier

Method signature

+ (nullable NSString *)adid;

Adtrace generates a unique Adtrace device ID (adid) for each device. Call adid to return this ID as an NSString.

Important

The adid is only available after Adtrace tracks the app install. You cannot read it before the SDK is initialized and the install has been successfully tracked.

Example

NSString *adid = [Adtrace adid];

ID for Advertisers (IDFA)

Method signature

+ (nullable NSString *)idfa;

The IDFA (Identifier for Advertisers) is a device-specific identifier on Apple devices. Call idfa to return this ID as an NSString.

Some analytics services need you to coordinate device and client IDs to prevent duplicate reporting. You can also pass {idfa} as a callback parameter placeholder or session callback parameter.

App Tracking Transparency

On iOS 14+, IDFA is only available when the user authorizes tracking. Request authorization with App Tracking Transparency before you expect a non-nil value. If the user denies tracking or has not been prompted yet, idfa may return nil.

Users can also limit ad tracking in system settings. Do not assume IDFA is always present.

Example

NSString *idfa = [Adtrace idfa];

In WebBridge integrations, getIdfa is asynchronous and delivers the value in the callback.