Knowledge base

Data privacy and consent

Unity Ads provides built-in solutions for acquiring user consent to data collection, as well as developer APIs for passing a flag should you wish to implement your own consent flow. Passing an affirmative consent flag (consent == "true") to the SDK means that Unity and its partners can show personalized content for that user, while consent == "false" means that user cannot receive personalized content.

Some regions may require consent to collect personal data by law, most notably for GDPR or CCPA regulations. However, consent extends beyond these use cases and should be applied in any region that requires it.

GDPR compliance

On May 25, 2018, the General Data Protection Regulation (GDPR) took effect in the European Economic Area (EEA), and all versions of the Unity Ads SDK are compliant.

Unity's built-in solution

Unity recommends that you update to the latest version of the SDK, but it is not required for GDPR compliance. Legacy versions (below version 2.0) of the SDK now only serve contextual ads to users, strictly based on geographic location and current gameplay. No historical or personal data is used for ad targeting, including user behavior within the app and across other apps, or installs.

Versions 2.0 and higher automatically present affected users with an opportunity to opt in to targeted advertising, with no implementation needed from the publisher. On a per-app basis, the first time a Unity ad appears, the user sees a banner with the option to opt in to behaviorally targeted advertising. Thereafter, the user can click an information button to manage their privacy choices.

Implementing a custom solution

If a publisher or mediator manually requests a user opt-in, the Unity opt-in will not appear. Please note that users can still request opt-out or data deletion, and access their data at any time by tapping the Unity Data Privacy icon when or after an ad appears.

Use the following API to pass a consent flag to the Unity Ads SDK:

Unity (C#)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// Note: The second parameter is an object (a string in this example). Using a boolean value will result in an error.
// If the user opts in to targeted advertising:
MetaData gdprMetaData = new MetaData("gdpr");
gdprMetaData.Set("consent", "true");
Advertisement.SetMetaData(gdprMetaData);

// If the user opts out of targeted advertising:
MetaData gdprMetaData = new MetaData("gdpr");
gdprMetaData.Set("consent", "false");
Advertisement.SetMetaData(gdprMetaData);

iOS (Objective-C)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user opts in to targeted advertising:
UADSMetaData *gdprConsentMetaData = [[UADSMetaData alloc] init];
[gdprConsentMetaData set:@"gdpr.consent" value:@YES];
[gdprConsentMetaData commit];

// If the user opts out of targeted advertising:
UADSMetaData *gdprConsentMetaData = [[UADSMetaData alloc] init];
[gdprConsentMetaData set:@"gdpr.consent" value:@NO];
[gdprConsentMetaData commit];

Android (Java)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user opts in to targeted advertising:
MetaData gdprMetaData = new MetaData(this);
gdprMetaData.set("gdpr.consent", true);
gdprMetaData.commit();

// If the user opts out of targeted advertising:
MetaData gdprMetaData = new MetaData(this);
gdprMetaData.set("gdpr.consent", false);
gdprMetaData.commit();

If the user takes no action to agree or disagree to targeted advertising (for example, closing the prompt), Unity recommends re-prompting them at a later time.

Please visit our legal site for more information on Unity's approach to GDPR.

CCPA compliance

In January of 2019, the California Consumer Privacy Act (CCPA) takes effect in California, and all versions of the Unity Ads SDK are compliant.

Unity's built-in solution

Unity recommends that you update to the latest version of the SDK, but it is not required for CCPA compliance. Versions 2.0 and higher automatically present affected users with an age-gated consent flow for targeted advertising, with no implementation needed from the publisher.

Implementing a custom solution

If a publisher or mediator manually requests a user opt-in, they can use the following API to pass a consent flag to the Unity Ads SDK. If Unity receives this flag, its built-in opt-in will not appear.

Unity (C#)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// Note: The second parameter is an object (a string in this example). Using a boolean value will result in an error.
// If the user opts in to targeted advertising:
MetaData privacyMetaData = new MetaData("privacy");
privacyMetaData.Set("consent", "true");
Advertisement.SetMetaData(privacyMetaData);

// If the user opts out of targeted advertising:
MetaData privacyMetaData = new MetaData("privacy");
privacyMetaData.Set("consent", "false");
Advertisement.SetMetaData(privacyMetaData);

iOS (Objective-C)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user opts in to targeted advertising:
UADSMetaData *privacyConsentMetaData = [[UADSMetaData alloc] init];
[privacyConsentMetaData set:@"privacy.consent" value:@YES];
[privacyConsentMetaData commit];

// If the user opts out of targeted advertising:
UADSMetaData *privacyConsentMetaData = [[UADSMetaData alloc] init];
[privacyConsentMetaData set:@"privacy.consent" value:@NO];
[privacyConsentMetaData commit];

Android (Java)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user opts in to targeted advertising:
MetaData privacyMetaData = new MetaData(this);
privacyMetaData.set("privacy.consent", true);
privacyMetaData.commit();

// If the user opts out of targeted advertising:
MetaData privacyMetaData = new MetaData(this);
privacyMetaData.set("privacy.consent", false);
privacyMetaData.commit();

Note: If you've already implemented the gdpr API to solicit consent, you can also use it for CCPA compliance by extending your implementation to CCPA-affected users. Similarly, the privacy API can apply to GDPR when extended to affected users.

Please visit our legal site for more information on Unity's approach to CCPA.

Custom age gates

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.

Unity (C#):

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// Note: The second parameter is an object (a string in this example). Using a boolean value will result in an error.
// 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);

Android (Java)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user is over the specified age limit:
MetaData ageGateMetaData = new MetaData(this);
ageGateMetaData.set("privacy.useroveragelimit", true);
ageGateMetaData.commit();

// If the user is under the specified age limit:
MetaData ageGateMetaData = new MetaData(this);
ageGateMetaData.set("privacy.useroveragelimit", false);
ageGateMetaData.commit();

iOS (Objective-C)

// Note: You must commit the changes to the MetaData for each value before trying to set another value.
// If the user is over the specified age limit:
UADSMetaData *ageGateMetaData = [[UADSMetaData alloc] init];
[ageGateMetaData set:@"privacy.useroveragelimit" value:@YES];
[ageGateMetaData commit];

// If the user is under the specified age limit:
UADSMetaData *ageGateMetaData = [[UADSMetaData alloc] init];
[ageGateMetaData set:@"privacy.useroveragelimit" value:@NO];
[ageGateMetaData commit];

iOS ad tracking transparency

Apple requires developers to provide custom text, which is displayed as a system-permission alert request, informing the user that the app is requesting permission to use user or device tracking data. For more information on how to implement this, see the iOS integration documentation.

Contextual Ads control

There are two types of ads that can appear in your game:

  • Personalized Ads are ads that users are more likely to click on. For example, if a user has played a series of sport-themed games, ads for other games with similar sports themes might appear. Personalized ads are not allowed to be presented in games intended for children under 13. Games that allow personalized ads tend to accrue more revenue than games that allow contextual ads.

  • Contextual Ads are ads that appear based only on the game that the user is currently playing. For example, if the user is playing a game that features basketball, only other games that feature basketball are likely to appear, regardless of other games the user has played. Games that have allowed only contextual ads tend to accrue less revenue than games that allow personalized ads. Only contextual ads are allowed in games intended to be played by children under the age of 13.

Personalized ads are sometimes considered to be a privacy concern by certain jurisdictions, regardless of the age group targeted by the game.

Allowing contextual ads only

To allow only contextual ads in your game:

  1. Navigate to the Project Info settings.
  2. Find the Contextual Ads control setting.
  3. Choose Don't allow personalized ads.

Allowing personalized ads

To allow personalized ads in your game:

  1. Navigate to the Project Info settings.
  2. Find the Contextual Ads control setting.
  3. Choose Allow personalized ads.

Note: If the Game Level Designation indicates that the game is directed towards children under 13 years of age, the Contextual Ads setting will be inactive.

For more information see COPPA compliance.

Still need help? Get in touch!
Last updated on 22nd Oct 2021