Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
Dismiss Notice
Join us now in the Performance Profiling Dev Blitz Day 2023 - Q&A forum where you can connect with our teams behind the Memory and CPU Profilers and the Frame Debugger.

Question Not Receiving GDPR Consent Requirement

Discussion in 'Unity Analytics' started by OwenSquirrel, Aug 11, 2022.

  1. OwenSquirrel


    Oct 10, 2021
    As far as my knowledge goes, and as listed on the Analytics Documentation, GDPR is an opt-in type of consent, similar to PIPL.
    I am based in Malta which is a country covered by GDPR. However, when checking for required consents using the code below, which I obtained from the documentation, I am not receiving an identifier for GDPR.
    Furthermore, when connecting to China using a VPN, I did receive a PIPL identifier.

    Using Analytics version 4.1.0
    Unity 2021.3.1f1

    Code (CSharp):
    1. List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
  2. Julian-Unity3D


    Unity Technologies

    Apr 28, 2022
    Hey @OwenSquirrel

    is an automatic Opt-In,
    To allow users to opt-out, you can create a button which calls :

    Take a look at this documentation for further instructions: Data privacy and consent (

    TL;DR for the documentation:
    To get the URL, you can use:
  3. OwenSquirrel


    Oct 10, 2021
    The idea is to have a similar consent flow to the sample shown below (taken from the documentation).
    GDPR requires user opt-in (not automatic, similar to PIPL) but the CheckForRequiredConsents() function is not returning gdpr as a consent identifier.

    I understand that the user can opt out of data collection but the problem is that although I am in a GDPR covered region, I am not receiving GDPR as a consent identifier.

    Code (CSharp):
    1. public class PrivacyManager : MonoBehaviour
    2. {
    3.    // Store whether opt in consent is required, and what consent ID to use
    4.    string consentIdentifier;
    5.    bool isOptInConsentRequired;
    7.    // Start is called before the first frame update
    8.    async void Start()
    9.    {
    10.        try
    11.        {
    12.            await UnityServices.InitializeAsync();
    13.            List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
    14.            if (consentIdentifiers.Count > 0)
    15.            {
    16.                consentIdentifier = consentIdentifiers[0];
    17.                isOptInConsentRequired = consentIdentifier == "pipl";
    18.            }
    19.        }
    20.        catch (ConsentCheckException e)
    21.        {
    22.            // Something went wrong when checking the GeoIP, check the e.Reason and handle appropriately
    23.        }
    24.    }
    26.    public void CheckUserConsent()
    27.    {
    28.        try
    29.        {
    30.            if (isOptInConsentRequired)
    31.            {
    32.                // Show a PIPL consent flow
    33.                // ...
    35.                // If consent is provided for both use and export
    36.                AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, true);
    38.                // If consent is not provided
    39.                AnalyticsService.Instance.ProvideOptInConsent(consentIdentifier, false);
    40.            }
    41.        }
    42.        catch (ConsentCheckException e)
    43.        {
    44.            // Handle the exception by checking e.Reason
    45.        }
    46.    }
    47. }
    Alex-id likes this.
  4. PeachyPixels


    Feb 17, 2018
    I believe GDPR & CCPA are not working as you would expect with the current analytics version.

    I too experienced this 'issue' and was told the consent process is only in-place for PIPL at present (where opt consent is mandatory)
    OwenSquirrel likes this.