firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
199 stars 32 forks source link

[Question] Where is documentation on how to link Google UMP consent results with Firebase consent? #949

Open batteredhedgehog opened 4 months ago

batteredhedgehog commented 4 months ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the question here:

I am unable to find documentation on how to configure Firebase to update consent with data coming from google's UMP. Please can you explain how to link the two, or point me to some documentation.

paulinon commented 4 months ago

Hi @batteredhedgehog,

You can use the SetConsent function to set the consent state. You may have to do some preliminary steps to set up consent mode for your app (depending on your platform). You may refer to this example in our quickstart to see how it's being used.

That said, I'll be closing this for now. Let me know if an issue arises so this ticket could be reopened.

Remstam commented 4 months ago

I think @batteredhedgehog wants some kind of conversion function from TCFStrings (which are created after UMP popup choices were made) to Firebase flags for SetConsent function.

I am interested in this too, my current guess is to rely on Tag Behaviour docs. It is possible to take selected purposes string from shared preferences (Android) or NSUserDefaults (iOS) by _IABTCFPurposeConsents key and go on from there.

But I am not sure if that is the right way to get values for SetConsent call, wonder if there are any other opinions.

batteredhedgehog commented 4 months ago

@paulinon - thanks for the info. I do understand how the SetConsent function is intended to work. As @Remstam says, I'm looking for the correct way to extract consent information from TCF strings.

  1. Can you point me to a mapping between purposes and the consent mode v2 flags used in SetConsent ?
  2. Should we be using PurposeConsents?
  3. Do we need to look into google vendor consent purposes?
  4. (edit) I notice that the TCF vendor list only has one entry for google: "755: Google Advertising Products". Does this vendor also cover Firebase Analytics ?

Any assistance would be very helpful. Answers to the above questions would greatly help me to move forward.

cometa93 commented 3 months ago

Bump

OldSlash commented 3 months ago

Any updates?

llfabris commented 3 months ago

up

batteredhedgehog commented 3 months ago

For anyone interested - I did the following:

I dont really know if this is 100% correct - but its a start .
Any guidance from google would be greatly appreciated.

batteredhedgehog commented 3 months ago

And here is some c# code snippets I wrote to help extract consent from the TCF string.

    private const string IABTCF_PurposeConsents = "IABTCF_PurposeConsents";
    private const string IABTCF_PurposeLegitimateInterests = "IABTCF_PurposeLegitimateInterests";
    private const string IABTCF_VendorConsents = "IABTCF_VendorConsents";
    private const string IABTCF_VendorLegitimateInterests = "IABTCF_VendorLegitimateInterests";
    private const string IABTCF_PublisherConsent = "IABTCF_PublisherConsent";
    private const string IABTCF_PublisherLegitimateInterests = "IABTCF_PublisherLegitimateInterests";

    public const int IABTCF_GOOGLE_VENDOR_ID = 755;

    private static bool IsBitSet(int nonZeroBasedBitIndex, string bitString)
    {
        return nonZeroBasedBitIndex > 0 && bitString != null && bitString.Length >= nonZeroBasedBitIndex && bitString[nonZeroBasedBitIndex - 1] == '1';
    }

    public static bool HasConsent(string purposeString, string vendorString, int purposeId, int? vendorId = null)
    {
        return IsBitSet(purposeId, ApplicationPreferences.GetString(purposeString)) && ((!vendorId.HasValue) || IsBitSet(vendorId.Value, ApplicationPreferences.GetString(vendorString)));
    }

    public static bool HasPurposeConsent(int purposeId, int? vendorId = null)
    {
        return HasConsent(IABTCF_PurposeConsents, IABTCF_VendorConsents, purposeId, vendorId);
    }

    public static bool HasLegitimateInterest(int purposeId, int? vendorId = null)
    {
        return HasConsent(IABTCF_PurposeLegitimateInterests, IABTCF_VendorLegitimateInterests, purposeId, vendorId);
    }

    public static bool HasPublisherConsent(int purposeId)
    {
        return HasConsent(IABTCF_PublisherConsent, null, purposeId);
    }

    public static bool HasPublisherLegitimateInterest(int purposeId)
    {
        return HasConsent(IABTCF_PublisherLegitimateInterests, null, purposeId);
    }
binouze commented 2 months ago

Hi,

It seems that since Firebase Android SDK 32.8.0 and Firebase iOS SDK 10.23.0, Firebase Analytics gets a new feature:

Any ETA on when this will be available in the Unity SDK ? Or maybe is it possible to just update the dependencies ?

Remstam commented 2 months ago

Ok, 11.9.0 release gets updates to Android 32.8.1 and iOS 10.24.0 respectively. Does this mean it is no more necessary to manually call SetConsent as Analytics will now itself automatically get the values from TCF string internally?

akshaymoonfrog commented 2 months ago

Bump

binouze commented 2 months ago

Hi,

With the 11.9.0 update is it still necessary to modify the AndroidManifest.xml to add:

<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="false" />
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="false" />
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="false" />
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="false" />
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />

Or all this is done automatically based on the TCF values ?

How does this work for non UE users ? Will it reactivate it automatically or I need to do it manually ?

What about the values changes, if I show the GoogleUserMessagingPlatform form to the user, is there something to call on FirebaseAnalytics to update the values when the form is closed ?

ismetdegoo commented 1 month ago

Any updates?

WBoda commented 1 month ago

up

argzdev commented 1 month ago

Hi folks, could you kindly add a thumbs up emoji to the author's original post. This will help us keep track of issues under our radar. That said, I'll bring this up to our engineer sync to get some feedback. Thanks!

stergios222 commented 1 month ago

up

Iq51 commented 3 weeks ago

Bump

batteredhedgehog commented 1 week ago

Bump. Can we please get some guidance on this.

nahrak commented 1 week ago

Bump. Firebase shows a message, which reads "Ads personalization consent signals not detected".

This page describes how to enable consent mode with TCF and says it is automatically enabled: https://developers.google.com/tag-platform/security/guides/implement-TCF-strings#apps

Do we still need to manually set everything else to false in AndroidManifest.xml though?