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


If we dont use Unity’s authentication, what reference of the user is removed from Unity Analytics when a user opts out? - the device id? the game id with the device id? Can’t quite understand from the documentation:

“Unity Analytics does not track whether the same player plays more than one game made with Unity, or plays the same game on multiple devices.”

We would like to understand this so we can debug and test our privacy code accross devices.

Thank you

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.


@RendergonPolygons You can use Charles Proxy to see exactly what is data being sent from the device https://support.unity.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity

1 Like

That’s very helpful, thank you both ! @EllieF_Unity Should I use the legacy system to get the GUID generated by the new Unity Analytics system or how do I get the GUID with the new system? Thanks!

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)

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 !

This may help https://discussions.unity.com/t/712661/4 , or you can use Charles, it will be in the outgoing request.

Thanks a bunch [mention|FoT1X6hnMLAUmFLAiyG1NQ==] , great we can continue to use AnalyticsSessionInfo.userId ! we don't get anything from Charles Proxy in this occassion because we had opted out running player on Editor in a production option Environment (before we heard we could opt back in by clearing playerprefs in dev env) and we can't opt back in, so now Charles Proxy only shows us this error Curl error 60: Cert verify failed: UNITYTLS_X509VERIFY_FLAG_EXPIRED

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.


Thanks a lot for looking into it, it’s sent, cheers !

1 Like

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

1 Like


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.

1 Like

@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 !

1 Like

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?

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:

  • Player has been playing the game and has sent in events.
  • 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.
  • Unity Analytics backend acknowledges the forget request and starts the 7 day grace period.
  • 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.
  • 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:

var options = new InitializationOptions();

await UnityServices.InitializeAsync(options);

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 !