Reputation: 546
Hi I was wondering what is the correct way to do this. Facebook documentation is kind of misleading. On Meta for developers website on the page titled Advertising Tracking Enabled they say you should use snippet
Settings.shared.isAdvertiserTrackingEnabled = true
But on the Get Started – iOS near the bottom of the document there is title Get Device Consent. There they also mention
Settings.shared.isAutoLogAppEventsEnabled = false
Settings.shared.isAdvertiserIDCollectionEnabled = true
So should I also set these two to false if the user declines to share data?
Also if I edit my Info.plist file and add lines
FacebookAutoLogAppEventsEnabled FacebookAdvertiserIDCollectionEnabled
as the Getting started advises won't this be disabled every time I launch the app? I would be overwritten to true only one time when iOS native AppTracking dialog would show up and user would click Allow. Am I right?
Thanks
Upvotes: 2
Views: 2402
Reputation: 11
I also exactly had the same question when I was integrating Facebook SDK. I ended up solving problem like this.
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
...
// initialize Facebook SDK
ApplicationDelegate.shared.application(application,
didFinishLaunchingWithOptions: launchOptions)
Settings.isAutoLogAppEventsEnabled = false
Settings.setAdvertiserTrackingEnabled(false)
Settings.isAdvertiserIDCollectionEnabled = false
}
ATTrackingManager.requestTrackingAuthorization { [weak self] status in
let isConsented = status == .authorized
Settings.isAutoLogAppEventsEnabled = isConsented
Settings.setAdvertiserTrackingEnabled(isConsented)
Settings.isAdvertiserIDCollectionEnabled = isConsented
}
func checkATTStatus() {
log.debug("current ATT status: \(ATTrackingManager.trackingAuthorizationStatus)")
let isConsented = ATTrackingManager.trackingAuthorizationStatus == .authorized
Settings.isAutoLogAppEventsEnabled = isConsented
Settings.setAdvertiserTrackingEnabled(isConsented)
Settings.isAdvertiserIDCollectionEnabled = isConsented
}
I'm not 100% sure about this because I am still in testing stage (also Facebook's test event page is not working properly).
Please correct me if I am wrong.
Upvotes: 1