I think I did not get an accurate install number from Facebook Ads Manager reporting.
Is it because my iOS app doesn't implement ATT?
If yes, may I know is this the correct implementation?
The documentation regarding this isn't clear - https://developers.facebook.com/docs/app-events/guides/advertising-tracking-enabled
I was wondering, is this code snippet correct enough, so that I can get a more accurate reporting in my Facebook Ad Manager? Thank you.
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func requestTrackingPermission() {
if #available(iOS 14, *), #available(iOS 17, *) {
// For iOS 17 and later: ATT API is automatically used by Facebook SDK
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
print("ATT authorized: Tracking enabled automatically by Facebook SDK for iOS 17+.")

case .denied, .restricted:
print("ATT denied/restricted: Tracking disabled automatically by Facebook SDK for iOS 17+.")

case .notDetermined:
print("ATT not determined: No action, default to disabled.")

@unknown default:
print("ATT unknown status: No action, default to disabled.")
}
}
} else if #available(iOS 14, *) {
// For iOS 14 to iOS 16: Manually set Advertiser Tracking Enabled parameter
ATTrackingManager.requestTrackingAuthorization { status in
switch status {
case .authorized:
Settings.shared.isAdvertiserTrackingEnabled = true
print("ATT authorized: Tracking enabled.")

case .denied, .restricted:
Settings.shared.isAdvertiserTrackingEnabled = false
print("ATT denied/restricted: Tracking disabled.")

case .notDetermined:
Settings.shared.isAdvertiserTrackingEnabled = false
print("ATT not determined: Defaulting to tracking disabled.")

@unknown default:
Settings.shared.isAdvertiserTrackingEnabled = false
print("ATT unknown status: Defaulting to tracking disabled.")
}
}
}
}

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
////////////////////////////////////////////////////////////////////////////////////////////
/// FACEBOOK
////////////////////////////////////////////////////////////////////////////////////////////
///
// https://developers.facebook.com/docs/app-events/getting-started-app-events-ios
ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)

// Request Tracking Permission
requestTrackingPermission()

return true
}
}

Tag:-

Add a new comment.