Guides
GuidesLog In

Device Identifiers

Overview

Advertising Device Identifiers include:

  • IDFA (iOS)
  • IDFV (iOS)
  • Advertiser ID (Android)
  • App Set ID (Android)

Collecting Device Identifiers is required for marketing attribution providers: AppsFlyer, Branch, Facebook, Adjust, Tenjin, Singular, etc.

If you don't use such integrations, you may ignore this guide.

iOS

Since version 3.3.0, the iOS SDK no longer collects the Identifier For Vendor (IDFV) automatically. Failing to pass the IDFV might disrupt some of your MMP integration setups.

Call setDeviceIdentifiers(idfa: String?, idfv: String?) method immediately after the SDK initialization. If the advertising identifier (IDFA) is not available, pass only the IDFV.

When IDFA becomes available, you can call setDeviceIdentifiers(idfa: String?, idfv: String?) again.

Sample Code:

import AppTrackingTransparency
import AdSupport

Apphud.start(apiKey: "YOUR_API_KEY")
Apphud.setDeviceIdentifiers(idfa: nil, idfv: UIDevice.current.identifierForVendor?.uuidString)
fetchIDFA()

func fetchIDFA() {
        if #available(iOS 14.5, *) {
            DispatchQueue.main.asyncAfter(deadline: .now()+2.0) {
                ATTrackingManager.requestTrackingAuthorization { status in
                    guard status == .authorized else {return}
                    let idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
                    Apphud.setDeviceIdentifiers(idfa: idfa, idfv: UIDevice.current.identifierForVendor?.uuidString)
                }
            }
        }
    }

📘

Important

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

Android

Call Apphud.collectDeviceIdentifiers() method after the SDK initialization.
When targeting Android 13 and above, you must also declare AD_ID permission in the manifest file.

Apphud.start(this, API_KEY)
Apphud.collectDeviceIdentifiers()

Flutter

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

// Use following methods:

/// iOS (IDFV is collected automatically in this method since SDK v2.6.0)
static Future<void> setAdvertisingIdentifier(String idfa) async

/// Android (Collects Advertiser ID and App Set ID)
static Future<void> collectDeviceIdentifiers()

App Store Privacy

Even with the use of IDFA, it is still necessary to accurately fill out the App Store Privacy Information.

For more details, please refer to Apple Guide.