Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Question AnalyticsService.PrivacyUrl returning privacy policy

Discussion in 'Unity Analytics' started by jonathanhook, Aug 14, 2022.

  1. jonathanhook

    jonathanhook

    Joined:
    Feb 11, 2015
    Posts:
    10
    Hi all,

    I’m hoping to have a button in my app that’s displays a personal data management page, as described below:

    https://docs.unity3d.com/Manual/UnityAnalyticsDataPrivacyAPI.html

    The reason for this is I use Ads and IAP, but have a “no ads” purchase that means the user no longer can access the privacy dialogue shown with an ad.

    However, I’m using the new analytics service not the legacy approach. I’ve tried to implement the feature using the new API for this. However, it seems like this new API doesn’t return the url of a personalised page where the user can edit their preferences. Rather, it just sends back the url of the unity privacy policy.

    I’ve had a look in the plug-in code, and it seems this is what it’s supposed to do. The property has that url set as it’s value.

    Is it possible to achieve the old-style “fetch privacy url” functionality with the new analytics? Or is there another way I should be going about this. For example, is there another call somewhere to show the little button with the hand that appears for ads?

    Thanks :)
     
  2. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    Hello @jonathanhook

    I understand your concerns, however the ads privacy dialogue that is presented to the user is different to that of the Analytics. Data is processed differently for Ads and Analytics and you need to present the option to opt out of Analytics data being collected directly to the user using your own method.

    CheckForRequiredConsents
    is an automatic Opt-In for Non PIPL Compliance areas,

    Take a look at this documentation for further instructions: Data privacy and consent (unity.com)

    See this page for further details on opt-out for GDPR and CCPA: GDPR and CCPA compliance (unity.com)

    TL;DR for the documentation on GDPR and CCPA:
    To get the Privacy URL, you can use:
    Application.OpenURL(Events.PrivacyUrl);


    To allow users to opt-out, you can create a button which calls :
    public void OptOut()

    Here is the function:
    Code (CSharp):
    1. public void OptOut()
    2.     {
    3.         try
    4.         {
    5.             if (!consentHasBeenChecked)
    6.             {
    7.                 // Show a GDPR/COPPA/other opt-out consent flow  
    8.                 // If a user opts out
    9.                 AnalyticsService.Instance.OptOut();
    10.              }
    11.              // Record that we have checked a user's consent, so we don't repeat the flow unnecessarily.
    12.              // In a real game, use PlayerPrefs or an equivalent to persist this state between sessions
    13.             consentHasBeenChecked = true;
    14.         }
    15.         catch (ConsentCheckException e)
    16.         {
    17.             // Handle the exception by checking e.Reason
    18.         }
    19.     }
     
    Last edited: Aug 23, 2022
    Haze-Games likes this.
  3. jonathanhook

    jonathanhook

    Joined:
    Feb 11, 2015
    Posts:
    10
    Thanks very much for your reply. I hadn't realised they were two separate required consent processes. This info has made a lightbulb switch on above my head, and the docs make sense now.
     
    Julian-Unity3D likes this.
  4. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    192
    Hi @Julian-Unity3D ,

    Thanks for your reply. I however still have doubts and require some confirmation here. We are migrating from Legacy Analytics to Unity Gaming Services and something is still unclear to me.

    BEFORE UNITY GAMING SERVICES
    Previously, with Legacy Analytics (no ads in the game), we used to do this:
    - Show our privacy policy for the game
    - With button to Unity Privacy Policy (to read it)
    - DataPrivacyPlugin button (with Unity hand icon): Allows the users to opt out of Analytics
    - OK button to agree our Privacy Policy and close (automatic opt-in if user doesn't click the DataPrivacyPlugin button (with Unity hand icon)

    WITH NEW UNITY GAMING SERVICES
    Now, with Unity Gaming Services, and reading your response, it seems to me like:
    - DataPrivacyPlugin button (with Unity hand icon) is now deprecated and must be removed, because it's not useful anymore
    - We should simply opt-in by default (in GDPR regions, non-PIPL)
    - Add button labelled "Disable Analytics" which simply calls the OptOut function of new UGS

    Can you please confirm that the WITH NEW UNITY GAMING SERVICES section above is correct, and we can fully remove DataPrivacyPlugin from the game, and simply call OptOut of the user clicks a button to opt out (or disables a checkbox) ?

    Thank you!
    Charles
     
  5. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    You are correct, you need to give the user the ability to Opt-out via calling the Opt-Out function as stated in the post above.
     
    Haze-Games likes this.
  6. Haze-Games

    Haze-Games

    Joined:
    Mar 1, 2015
    Posts:
    192
    OK, excellent, thank you for your reply! I'd strongly suggest to make it clear on the documentation of UGS and of the DataPrivacy plugin, that the DataPrivacy plugin is now deprecated and if you migrate to UGS, you should remove it entirely and use this new opt out system, as it's confusing to have both solutions available without a clear understanding that the "old way" using the DataPrivacy plugin is no longer a valid flow. Thank you!
     
    Julian-Unity3D likes this.
  7. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    223

    I'm also in the progress of moving from Legacy to New Unity Analytics.

    I don't understand why obsolete code and method calls are suggested by you?
    Have the library changed recently, because I see the same code samples as you provide here in the documentation, however using this code in my game gives me an obsolete message.

    Code (CSharp):
    1. Application.OpenURL(Events.PrivacyUrl);
    Is obsolete and below is now the way to do it, according to what I'm told by the intellisense in Visual Studio.

    Code (CSharp):
    1.  Application.OpenURL(AnalyticsService.Instance.PrivacyUrl);
    Also the "options" sample for setting the environment is not working as the code in the sample doesn't work.

    So have the library changed lately or is the documentation just far far behind?


    When that said, this whole privacy flow was MUCH better and easier for developers in the old version. I assume the flow is the same for all games more or less, as it doesn't have anything to do with the game, so why don't Unity make a good solution that is easy for developers to use - like in the legacy version?
     
  8. Deleted User

    Deleted User

    Guest

    A few questions to clarify some confusion I have...
    • Do I need to to provide an Opt-Out button if my application is NOT collecting personal data?
    • Does UGS out of the box collect personal data? (I.E. no customer events/parameters)
     
  9. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    If you don't have Analytics installed as a package, then Analytics will not be used.
    Therefore, you don't need and won't be able to provide an opt-out button.


    Customers need the ability to Opt-out of Analytics even if no Custom Events are present, because Standard events are sent.
     
    Last edited: Oct 14, 2022
    Deleted User likes this.
  10. Deleted User

    Deleted User

    Guest

    @Julian-Unity3D follow-up question - Are the Standard events considered personal data?
     
  11. Deleted User

    Deleted User

    Guest

    Actually @Julian-Unity3D I'd love if you can confirm if this is an appropriate workflow for an application I'm building that will only be released in the United States.
    1. App Starts
    2. Code calls CheckForRequiredConsents();
    3. Code handles consents if any are returned from CheckForRequiredConsents()
      • If PIPL - code calls SetAnalyticsEnabled(false) and ProvidedOptInConsent("pipl", false). This shouldn't be a valid scenario b/c this app will be released in the United States only. It's only implemented as a failsafe.
      • If GDPR - code calls SetAnalyticsEnabled(false) and OptOut(). This shouldn't be a valid scenario b/c this app will be released in the United States only. It's only implemented as a failsafe.
      • If CCPA - does nothing.
    Additionally, in the settings UI of the app - there is an OptOut button for users to select.

    I appreciate your time in answering my questions. To be honest, I do not find the documentation straight forward. Up until this thread I didn't think we needed to provide an OptOut button for Standard Events only.
     
    Last edited by a moderator: Oct 14, 2022
  12. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
  13. Deleted User

    Deleted User

    Guest

    Thanks for the answers Julian the 2nd link is a bit easier to understand. So, I will need to display a consent pop-up for GDPR/CCPA at app start.
     
    Julian-Unity3D likes this.