Search Unity

Question Can a player Opt back in?

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

  1. OwenSquirrel

    OwenSquirrel

    Joined:
    Oct 10, 2021
    Posts:
    10
    After using AnalyticsService.Instance.OptOut();, is there a way for the player to 'Opt back in' and start receiving events from the user again?

    AnalyticsService.Instance.ProvideOptInConsent(_consentIdentifier, true); requires a valid consent Identifier. If the player is from a region that does not require opt in consent, can this function be used to achieve my question?
     
  2. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    704
    I don't believe there is a way to opt back in, but I really wish there was.

    I'm sure there are metrics that say once players opt out, they never opt back in. But sometimes it's about perception of choice. To not even have the option is a little frustrating imo.

    I don't see why an opt in option can't just cancel the (28 day) pending delete event and continue to process events again.

    I believe opt out is mainly for PIPL though. So if you're not supporting that, you could use SetAnalyticsEnabled instead. My understanding is that's a simple (client) toggle and does not send a delete data request (although I believe that might be a GDPR\CCPA requirement)
     
  3. OwenSquirrel

    OwenSquirrel

    Joined:
    Oct 10, 2021
    Posts:
    10
    In Unity's documentation, they used the Opt Out method for CCPA so I'm assuming it's required that the data is deleted.
     
  4. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    The
    CheckForRequiredConsents 
    API only returns identifiers for PIPL by design, although the name has caused much confusion it’s true. For GDPR and other legislations we expect users to just opt out as normal using the OptOut method - this is described in our privacy docs
     
  5. OwenSquirrel

    OwenSquirrel

    Joined:
    Oct 10, 2021
    Posts:
    10
    Okay, I just have a few questions.

    1. Doesn't the GDPR legislation require an 'Opt in' consent, similar to PIPL? Therefore, we cannot automatically opt the user in and just give them the option to opt out.
    2. Once a user opts out of data collection, is there a way for the user to choose to opt back in?
    3. Will the CheckForRequiredConsents API be improved to return other identifiers in the future?
     
  6. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    @OwenSquirrel

    I understand your concerns,
    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)

    You also need to make sure you present the user with the privacy URL.
    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.     }
    For a user to opt back in, you can go about it two ways, either uninstalling the app (most reliable and safest) or clearing PlayerPrefs and then restarting the app.
    Eitherway, the playerPrefs get deleted and the app needs to be started up for the first time again.

    We are currently discussing an easier option to opt back in, but there's no definite plans just yet.
     
    Last edited: Aug 23, 2022
    OwenSquirrel likes this.
  7. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    704
    Hi @Julian-Unity3D

    Yes the API is in desperate need of an OptIn method imo.

    I appreciate most who choose to OptOut will never choose to OptIn again, but I'm sure some did so by mistake.

    It also rules out having a toggle option in the UI (which is a simpler approach than primary and secondary (are you really sure) prompts.

    Most importantly it gives players choice, which makes for a better experience imo.

    Uninstalling the app is not really an option for players, it raises too many questions about what will be lost in the process. Deleting the (consent) player prefs is an option, but does that resume all Analytics operations? It certainly doesn't undo any pending 'forget me' backend events.

    So an OptIn that (optionally) removed any pending 'forget me' events would be perfect.

    Hope this helps.
     
    Last edited: Aug 23, 2022
    OwenSquirrel likes this.
  8. OwenSquirrel

    OwenSquirrel

    Joined:
    Oct 10, 2021
    Posts:
    10
    Thank you for your reply.
    In the case of removing the PlayerPref for an opt back in, which Key-Value Pair would have to be deleted?
     
  9. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    704
    I deleted these (for testing purposes)...
    Code (CSharp):
    1. PlayerPrefs.DeleteKey("unity.services.analytics.consent_status");
    2. PlayerPrefs.DeleteKey("unity.services.analytics.pipl_consent_status");
    They seemed to work but @Julian-Unity3D is best placed to confirm.
     
    levi9000 and OwenSquirrel like this.
  10. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    I do agree with you.

    I've done that many times myself.

    I do understand your concerns, and believe me, this is being discussed internally, in regards to what data will be lost, could you elaborate? PlayerPrefs as a best practice it shouldn't be used to hold any important data.

    I've actually been playing around with having a toggle within the UI to opt in and out, however the result is always the same, you need to restart the application.


    I have actually tried this method multiple times, however this isn't the official method so I can't condone it as it might break other things internally. But I had already found this out myself and shared it internally awhile ago. I think we're definitely onto something though. Thank you for all your input it greatly helps us improve our products.

    As noted above, I can't condone it, deleting the individual keys would still require you to restart the application and have other consequences. Do So At Your Own Risk.


    I hope all of this clears things up?
    I've also written a knowledgebase article which should help clear things up:
    Analytics Opt Out and Back In and Privacy URL – Unity
     
    PeachyPixels and OwenSquirrel like this.