Set up a custom consent solution
Implement a custom developer consent solution, whether you’re using a third-party mediator or mediating with Unity Ads exclusively.
Read time 1 minuteLast updated a day ago
The Unity Ads Privacy API provides three methods for communicating user privacy preferences:
Purpose | API method |
|---|---|
| Opt-in consent | |
| Opt-out signal | |
| Child-directed or non-behavioral users | |
For more information about the Unity Ads opt-in consent API, refer to the Unity Ads Privacy API reference for developers using Java, Kotlin, Objective-C, and Swift.
Opt-in consent API
Use the following examples to communicate whether the user has granted or declined consent for targeted advertising.Opt-in consent API
Use the following examples to communicate whether the user has granted or declined consent for targeted advertising.// 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 following examples to indicate whether the user has opted out of data collection under applicable privacy laws.// If the user opts in to personalized adsUnityAds.setUserOptOut(false)// If the user opts out to personalized adsUnityAds.setUserOptOut(true)
Age-restricted user specification API
Use the following examples to specify whether the app or user should be treated as child-directed or non-behavioral.// If the user opts out to personalized adsUnityAds.setNonBehavioral(true)// If the user opts in to personalized adsUnityAds.setNonBehavioral(false)