Implement custom age gates
Implement a custom age gate in your app. Set user age status to support compliance with child data privacy laws.
Read time 1 minuteLast updated 3 months ago
If a publisher or mediator implements a custom age gate solution, they can use the following API to pass an age gate flag to the Unity Ads SDK. If Unity receives this flag, its built-in age gate will not appear.
// If the user is over the specified age limit:MetaData ageGateMetaData = new MetaData("privacy");ageGateMetaData.Set("useroveragelimit", "true");Advertisement.SetMetaData(ageGateMetaData);// If the user is under the specified age limit:MetaData ageGateMetaData = new MetaData("privacy");gdprMetaData.Set("useroveragelimit", "false");Advertisement.SetMetaData(ageGateMetaData);