GDPR & CCPA Consent
For GDPR and CCPA CheckForRequiredConsents
will automatically opt-in by default, but you should offer the user a method to always Opt-Out.
To use CheckForRequiredConsents
in GDPR and CCPA regions you can use this function:
async void Start()
{
try
{
await UnityServices.InitializeAsync();
List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
}
catch (ConsentCheckException e)
{
// Something went wrong when checking the GeoIP, check the e.Reason and handle appropriately
}
}
More information regarding GDPR and CCPA Consent is in the documentation found here: GDPR and CCPA compliance (unity.com)
PIPL Consent
PIPL is an opt-in based legislation. You still need CheckForRequiredConsents
for PIPL legislation which is similar to GDPR and CCPA, You will need to add the if statement as below:
string consentIdentifier;
bool isOptInConsentRequired;
async void Start()
{
try
{
await UnityServices.InitializeAsync();
List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
if (consentIdentifiers.Count > 0)
{
consentIdentifier = consentIdentifiers[0];
isOptInConsentRequired = consentIdentifier == "pipl";
}
}
catch (ConsentCheckException e)
{
// Something went wrong when checking the GeoIP, check the e.Reason and handle appropriately
}
}
If it comes back as PIPL this function will return a list with a single string identifier “pipl”.
You are then obligated to ask the user for their consent before any other actions are triggered in the SDK. Consent can be provided or denied using the ProvideOptInConsent
method as seen below:
public void CheckUserConsent()
{
try
{
if (isOptInConsentRequired)
{
// Show a PIPL consent flow
// ...
// If consent is provided for both use and export
AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, true);
// If consent is not provided
AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, false);
}
}
catch (ConsentCheckException e)
{
// Handle the exception by checking e.Reason
}
}
}
More information regarding PIPL is in the documentation found here: PIPL compliance (unity.com)
Opt-Out
If the user wants to later opt-out they can do so using the same method for all applicable regulations by using the public void OptOut().
bool consentHasBeenChecked;
public void OptOut()
{
try
{
if (!consentHasBeenChecked)
{
// Show a GDPR/COPPA/other opt-out consent flow
// If a user opts out
AnalyticsService.Instance.OptOut();
}
// Record that we have checked a user's consent, so we don't repeat the flow unnecessarily.
// In a real game, use PlayerPrefs or an equivalent to persist this state between sessions
consentHasBeenChecked = true;
}
catch (ConsentCheckException e)
{
// Handle the exception by checking e.Reason
}
}
Privacy URL
You will also need to make sure you present the user with the privacy URL.
To get the privacy URL all you need to use is: Application.OpenURL(AnalyticsService.Instance.PrivacyUrl);
Opt-BackIn
Unfortunately we don't yet have an easy method to opt back in.
Three ways you can go about it are:
- Delete PlayerPrefs and restart application.
- Clear all data and cache for application.
- Uninstall application and reinstall.
Comments
0 comments
Article is closed for comments.