Baconeta-Studios / setting-the-stage

1 stars 0 forks source link

Implement Player analytics consent #124

Closed baconeta closed 2 weeks ago

baconeta commented 2 weeks ago

My approach here would be to check the playerprefs once the game has loaded looking for the consent_given key maybe as an int. If it's 1 the player has given consent, if it's 0 they have opted out and if it's -1 (maybe make this the default value if the key doesn't exist) we Instantiate some kind of prefab UI popup with a panel containing 2 buttons, which is serialized on the base analytics class that we can set in the inspector that asks the player yes or no for analytics with 2 buttons.

Then on pressing yes, we set the playerpref to 1 and callback to the analytics system to opt in and on no we set it to 0 and callback to opt out. Both buttons will then disable or destroy the game object. Eventually these same setups will be in the settings as a toggle so keep that in mind.

JamesCoburn246 commented 2 weeks ago

I have chosen to make -1=opt-out and 0=no-decision. This is because 0 is right between -1 and 1, and because 0 makes more sense as a default-value.

JamesCoburn246 commented 2 weeks ago

AnalyticsHandlerBase.OptIn(), AnalyticsHandlerBase.OptOut(), and AnalyticsHandlerBase.OptLater() are exposed for the prompt logic to call. OptLater() will cause the player to be prompted again when they launch the game next, but analytics will remain off for the time being.