Documentation

Support

Use the new beta privacy APIs

Implement the new beta privacy APIs by following the opt-in consent, opt-out signal, and age-restricted user specification APIs, respectively, for iOS (Swift, Objective-C) and Android (Kotlin, Java) development.
Read time 2 minutesLast updated 5 hours ago

Use the new beta privacy APIs

Review the opt-in consent, opt-out signal, and age-restricted specification APIs and relevant code samples for iOS or Android. Use the
setUserConsent()
API to display the user's opt-in choices for personalized ads.
Refer to the following tabs for platform-specific code examples to communicate whether the user has granted or declined consent for targeted advertising.
public static func setUserConsent(_ consentGranted: Bool)// If the user agrees to personalized adsUnityAds.setUserConsent(true)// If the user doesn't agree to personalized adsUnityAds.setUserConsent(false)

Opt-out signal API

Use the
setUserOptOut()
API to display the user's opt-in choices for personalized ads.
Refer to the following tabs for platform-specific code examples to communicate whether the user has granted or declined consent for targeted advertising.
public static func setUserOptOut(_ optOut: Bool)// If the user opts in to personalized adsUnityAds.setUserOptOut(false)// If the user opts out to personalized adsUnityAds.setUserOptOut(true)

Age-restricted users specification

Use the
setNonBehavioral()
API to indicate a user's eligibility for non-behavioral (contextual) ads.
Refer to the following tabs for platform-specific code examples to communicate whether a privacy framework requires contextual-only ad delivery, typically for content directed to children or younger users.
public static func setNonBehavioral(_ nonBehavioral: Bool)// If the user opts out to personalized adsUnityAds.setNonBehavioral(true)// If the user opts in to personalized adsUnityAds.setNonBehavioral(false)