PIPL compliance
Starting November 1, 2021, China’s Personal Information Protection Law (PIPL) policy will be enforced for users in mainland China.
Implement Unity's built-in consent solution
The recommended best practice is to update to the latest version of the Unity Ads SDK, but this is not required, but it is not required for PIPL compliance.
Legacy versions (earlier than version 2.0) of the SDK now only serve contextual ads to users, strictly based on geographic location and in-app actions.
SDK versions 2.0 and later 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 displays, a banner provides the option to opt in to behaviorally targeted advertising. Thereafter, the user can select an information button to manage their privacy choices.
Implement a custom consent solution
If a publisher or mediator manually requests a user opt-in by having their account manager enable Developer Consent in the Unity Ads Monetization dashboard, the Unity opt-in will not appear.
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.
Custom consent implementation using Developer Consent API
While the recommended best practice is to use boolean values for MetaData consent flags, the Unity Ads SDK also accepts integer values (1 or 0), interpreting 1 as “true” and 0 as “false”. This ensures compatibility with customized or legacy SDK implementations that may use these integer values. While the Unity Ads SDK supports integer values, publishers are encouraged to use boolean values to pass consent flags as shown in the following code examples.
Use the following API to pass the appropriate consent flags to the Unity Ads SDK:
Unity (C#)
// If the user opts in to sending their personal identifiable information outside of China:
MetaData piplMetaData = new MetaData("pipl");
piplMetaData.Set("consent", "true");
Advertisement.SetMetaData(piplMetaData);
// 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 sending their personal identifiable information outside of China:
MetaData piplMetaData = new MetaData("pipl");
piplMetaData.Set("consent", "false");
Advertisement.SetMetaData(piplMetaData);
// If the user opts out of targeted advertising:
MetaData privacyMetaData = new MetaData(this);
privacyMetaData.set("privacy.consent", false);
privacyMetaData.commit();
Note: You must commit the changes to the MetaData
object for each value before trying to set another value. You must also provide consent for sending a user's personal identifiable information outside of China and to targeted advertising for PIPL. The second parameter is an object (a string in this example); using a boolean value will result in an error.
iOS (Objective-C)
// If the user opts in to sending their personal identifiable information outside of China:
UADSMetaData *piplConsentMetaData = [[UADSMetaData alloc] init];
[piplConsentMetaData set:@"pipl.consent" value:@YES];
[piplConsentMetaData commit];
// 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 sending their personal identifiable information outside of China:
UADSMetaData *piplConsentMetaData = [[UADSMetaData alloc] init];
[piplConsentMetaData set:@"pipl.consent" value:@NO];
[piplConsentMetaData commit];
// If the user opts out of targeted advertising:
UADSMetaData *privacyConsentMetaData = [[UADSMetaData alloc] init];
[privacyConsentMetaData set:@"privacy.consent" value:@NO];
[privacyConsentMetaData commit];
Note: You must commit the changes to the MetaData
object for each value before trying to set another value. You must also provide consent for sending their personal identifiable information outside of China and to targeted advertising for PIPL.
Android (Java)
// If the user opts in to sending their personal identifiable information outside of China:
MetaData piplMetaData = new MetaData(this);
piplMetaData.set("pipl.consent", true);
piplMetaData.commit();
// 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 sending their personal identifiable information outside of China:
MetaData piplMetaData = new MetaData(this);
piplMetaData.set("pipl.consent", false);
piplMetaData.commit();
// If the user opts out of targeted advertising:
MetaData privacyMetaData = new MetaData(this);
privacyMetaData.set("privacy.consent", false);
privacyMetaData.commit();
Note: You must commit the changes to the MetaData for each value before trying to set another value. You must also provide consent for sending their personal identifiable information outside of China and to targeted advertising for PIPL.
Handling inaction
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.