Swift - App Tracking Transparency - How to show non-personalised AdMob content?

Viewed 1344

I'm trying to implement the App Tracking Transparency framework, and I'm stuck, how do I load non-personalised content when the user denies the prompt.

    if #available(iOS 14.5, *) {
        ATTrackingManager.requestTrackingAuthorization { (status) in
            switch status {
            case .denied:
                // What do I do here?
                //GADMobileAds.sharedInstance().start(completionHandler: nil)
            case .restricted, .notDetermined, .authorized:
                GADMobileAds.sharedInstance().start(completionHandler: nil)
            @unknown default: break
            }
        }
    } else {
        GADMobileAds.sharedInstance().start(completionHandler: nil)
    }
1 Answers

You don't need to do anything different. If the user denies tracking then the ad framework will simply receive 0000 for the IDFA. This prevents them from identifying the user and tracking them or providing personalised ads.

if #available(iOS 14.5, *) {
        ATTrackingManager.requestTrackingAuthorization { (status) in
            ADMobileAds.sharedInstance().start(completionHandler: nil)
        }
    } else {
        GADMobileAds.sharedInstance().start(completionHandler: nil)
    }

You could use the .denied status to show an alert that asks them to go into settings and allow it, but don't do that.

Related