quiver-dev / quiver-analytics-godot-plugin

Track how players are interacting with your Godot game, while still respecting their privacy.
MIT License
16 stars 1 forks source link

Analytics.approve_data_collection() returning true even when consent already collected #3

Open obfuscatedgenerated opened 1 week ago

obfuscatedgenerated commented 1 week ago

I have a basic demo UI for consent collection:

func _ready():
    # don't show if consent already requested
    print(Analytics.should_show_consent_dialog())
    print(Analytics.consent_requested)
    print(Analytics.consent_granted)
    if not Analytics.should_show_consent_dialog():
        print("Skipping consent check...")
        queue_free()

func _on_approve_pressed():
    Analytics.approve_data_collection()
    queue_free()

func _on_deny_pressed():
    Analytics.deny_data_collection()
    queue_free()

No matter what the user presses, the UI will always pop up every time. Analytics.should_show_consent_dialog() prints true, even when the analytics.cfg file records the consent properly and events are being fired. Even if Analytics.consent_granted is true, Analytics.consent_requested is always false at startup.

obfuscatedgenerated commented 1 week ago

Looks like consent_requested is never actually set from the config file: https://github.com/quiver-dev/quiver-analytics-godot-plugin/blob/a19568f29853efee39338d63712a7da44342b359/addons/quiver_analytics/analytics.gd#L90

Should be easy to fix by just adding a line similar to the one linked:

consent_granted = config.get_value("general", "granted")
consent_requested = config.get_value("general", "requested")
obfuscatedgenerated commented 1 week ago

The plugin is also not setting consent_requested when consent is denied because it seems to check if consent is granted as a precondition:

https://github.com/quiver-dev/quiver-analytics-godot-plugin/blob/a19568f29853efee39338d63712a7da44342b359/addons/quiver_analytics/analytics.gd#L149

Not sure the reason behind this but it means that deny data collection only works if it was already approved before!