Advertising Identifiers

📘

When is it required?

Collecting Device Adverising Identifiers is required for marketing attribution providers: AppsFlyer, Branch, Facebook, Adjust, Tenjin, Singular. If you don't use such integrations, you may ignore this guide.

Android

For Android SDK 1.8.0 or higher, Advertising Identifier is not collected automatically. You must manually call Apphud.collectDeviceIdentifiers() method after SDK initialization.
When targeting Android 13 and above, you must also declare AD_ID permission in the manifest file.

Apphud.collectDeviceIdentifiers()

iOS

Starting iOS 14.5 access to IDFA requires user consent. You should request IDFA manually using AppTrackingTransparency framework and pass it to Apphud. Update Apphud SDK to 1.0.5 or higher.

❗️

Important Note

Don't forget to add Privacy - Tracking Usage Description (NSUserTrackingUsageDescription) to your app's Info.plist

Here is code snippet how you can request IDFA:

Swift

#if canImport(AppTrackingTransparency)
    import AppTrackingTransparency
#endif

func requestIDFA() {
    if #available(iOS 14.5, *) {
        ATTrackingManager.requestTrackingAuthorization { status in
            guard status == .authorized else {return}
            let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
            Apphud.setAdvertisingIdentifier(idfa)
        }
    }
}

Flutter

On Flutter please use the following plugin:
https://pub.dev/packages/app_tracking_transparency

and then use:
static Future<void> setAdvertisingIdentifier(String idfa) async

Despite IDFA, filling correct App Store Privacy Information is also required. For more information, read here.