Search Unity

Question Optout removes what user reference data if no unity user authentication is used?

Discussion in 'Unity Analytics' started by RendergonPolygons, Jan 11, 2022.

  1. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
  2. EllieF_Unity

    EllieF_Unity

    Unity Technologies

    Joined:
    Nov 27, 2020
    Posts:
    39
    Hi there,

    The Unity Analytics generates its own GUID when a player first starts up the application to be used as a user id. This id is sent along with the events recorded by the SDK which can be used to look at players in the Event Manager in the Unity Dashboard and helps our backend differentiate between different players. When a player opts out, the consent status for Analytics (which is stored in the PlayerPrefs) will be changed so that the SDK will no longer send events from that application. A HTTP request will also be sent to Unity Analytics at this point to start a process to remove all events received from that user id from the data.

    The user id is stored in the PlayerPrefs. Since PlayerPrefs cannot be shared between multiple devices, then if the same player downloads the app on a second device Unity Analytics will consider each instance separate players. Additionally, the PlayerPrefs for one application cannot be read by any other application, so if multiple applications on a device has Unity Analytics enabled they will not be able to tell if any other application uses Unity Analytics or what the user ids for those other applications are.
     
    unity_Ctri and RendergonPolygons like this.
  3. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    RendergonPolygons likes this.
  4. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    May I ask, what do you need the GUID for? You can obtain it from the Charles Capture, or from PlayerPrefs (I haven't personally used the PlayerPrefs approach)
     
  6. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    Hey @JeffDUnity3D we're archiving a record at runtime of the GUID that opted out, we don't see a request sent success callback or a record on the unity dashboard but it's enough we hold onto the request sent, may I ask what's the key in player prefs to get it from there? Thank you !
     
    Last edited: Jan 11, 2022
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  8. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, you would need to capture the opt out request or the events prior. We've been hearing reports of the curl error, can you send me your Charles capture .chls file in private message with specific steps to reproduce? I will take a look.
     
    SebT_Unity and RendergonPolygons like this.
  10. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    Thanks a lot for looking into it, it's sent, cheers !
     
    SebT_Unity likes this.
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It looks like running Charles itself is generating that curl error response. Make sure to install the root certificate on your PC/Mac as described in the article, set the SSL Proxying Settings as described, and REBOOT
     
    RendergonPolygons likes this.
  12. EllieF_Unity

    EllieF_Unity

    Unity Technologies

    Joined:
    Nov 27, 2020
    Posts:
    39
    Hi,

    I think there is a bit of confusion between Legacy Analytics and the Unity Gaming Services Analytics Beta (UGS Analytics). You cannot use the code from the Legacy Analytics tools unfortunately as the UGS Analytics and Legacy Analytics tools use completely different packages and SDKs. If you still wish to retrieve the user id from PlayerPrefs (for UGS Analytics), the key is
    UnityAnalyticsInstallationId
    .

    I also received some additional information from the developers, which will be added to the documentation in more detail soon. When a forget request is received it is not processed straight away. Naturally, when the request is sent, the SDK will stop sending any events from the application. So, no new data will be recorded and sent from the SDK for that user as soon as the user opts-out of Analytics on the application. However, there is a 7 day grace period, in case the forget request was sent by accident through the RestAPI, for example in a bulk request send. If an event is received during the 7 day grace period from that user id, then the forgetting process will be halted. Additionally, deletion happens once a week, on Saturdays, so it can take up to 13 days for data to no longer appear on the Unity dashboard.
     
    RendergonPolygons likes this.
  13. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    @JeffDUnity3D yes sir, thanks for pointing this out -> I had not trusted the cert on macos, no curl error anymore :)
    PlayerPrefs works great, thank you @EllieF_Unity !
     
    EllieF_Unity likes this.
  14. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    Hi @EllieF_Unity can we confirm we understand please - does the grace period mechanic also apply on a production environment? I am asking because we see in Charles Proxy a standard event is fired and sent out with a corresponding 204 response when we play on the editor (on a mac) and the UUID didn't change from when we opted out (despite we've cleared playerprefs). Does this mean this UUID is now opted back in even though we had opted out with this same uuid in a prod env? can we see this confirmed opt back in anywhere?
     
    Last edited: Jan 12, 2022
  15. EllieF_Unity

    EllieF_Unity

    Unity Technologies

    Joined:
    Nov 27, 2020
    Posts:
    39
    The grace period applies on all environments on the Unity Dashboard side for when data gets deleted. Although, it is important to note that the requests are environment specific. If user "id-123" exists in multiple environments, then their data will only be removed from the environment that received the request. However, the SDK should stop sending in events as soon as the OptOut function is called, unless of course you have reset the PlayerPrefs. This is roughly the opt-out flow:

    1. Player has been playing the game and has sent in events.
    2. Player decides to opt-out of analytics.
      Events.OptOut();
      is called and a forget request is sent to the Unity Analytics backend. The SDK will now no longer send events.
    3. Unity Analytics backend acknowledges the forget request and starts the 7 day grace period.
    4. If at the end of the grace period no events have been received by the player (this is normally the case as the SDK should have stopped sending in events) then on the following Saturday all the events received from this player will be removed from the Unity Analytics data.
    5. If during the grace period an event is received from this player, then Unity Analytics will no longer delete the player's data on the following Saturday. This might happen if a forget request was originally sent in through the RestAPI and not from the SDK as the SDK can still send in events.
    There is no easy way to confirm if a player has opted back-in. However, if you look at the Event Browser page, you should be able to see the last 100 events received in the last 48 hours. This page will populate with the events roughly 5 -15 minutes after the event was sent. When an opt out request is sent, a "ddnaForgetMe" event will appear in the browser. If a user id has sent in any events after that event, then they have opted back-in. Naturally, this method is only possible for the first 48 hours after an opt out request has been sent.

    I incorrectly assumed earlier that the user id would change if the PlayerPrefs were cleared, but it seems I was wrong in this case...

    For testing purposes, if you wish to ensure that a testing id that has opted-out stays opted-out, I recommend that you set a custom user id in the code, so that you can change the user id after clearing the PlayerPrefs. You can do this by adding an option to the Unity Services initialization:

    Code (CSharp):
    1. var options = new InitializationOptions();
    2. options.SetAnalyticsUserId("testing-id-123");
    3.        
    4. await UnityServices.InitializeAsync(options);
     
  16. RendergonPolygons

    RendergonPolygons

    Joined:
    Oct 9, 2019
    Posts:
    98
    Thanks a lot @EllieF_Unity we can indeed see the flow you have highlighted in the dashboard, and creating a userID has simplified the debug process for us too. This was very helpful !
     
    SebT_Unity and EllieF_Unity like this.