Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
batteredhedgehog opened this issue Feb 20, 2024 · 16 comments

Comments

@batteredhedgehog
Copy link

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022.3.15f1
  • Firebase Unity SDK version: 11.7.0
  • Source you installed the SDK: FirebaseAnalytics (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: consent (Auth, Database, etc.)
  • Other Firebase Components in use: none (Auth, Database, etc.)
  • Additional SDKs you are using: Admob (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Linux (Mac, Windows, or Linux)
  • Platform you are targeting: Android / iOS (iOS, Android, and/or desktop)
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)
  • Pre-built SDK from the website or open-source from this repo: _____

[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
Copy link
Contributor

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
Copy link

Remstam commented Feb 21, 2024

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 IABTCF_PurposeConsents 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
Copy link
Author

batteredhedgehog commented Feb 21, 2024

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

@paulinon paulinon reopened this Feb 22, 2024
@paulinon paulinon added the needs-attention Need Googler's attention label Feb 23, 2024
@cometa93
Copy link

cometa93 commented Mar 3, 2024

Bump

@OldSlash
Copy link

OldSlash commented Mar 7, 2024

Any updates?

@llfabris
Copy link

up

@batteredhedgehog
Copy link
Author

For anyone interested - I did the following:

  • Delay initializing analytics and crashlytics until after UMP consent negotiation in my ApplicationManifest.xml using:
    <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" />
  • Once consent is negotiated I determine if google (IAB vendor 755) has been granted consent for purposes 1,3,4, and either consent of legitimate intereste for purpose 7.
  • I enable crashlytics (using Crashlytics.IsCrashlyticsCollectionEnabled = true if either consent wasn't required (as determined by UMP) or if the consents in the previous step were given.
  • I enable analytics using FirebaseAnalytics.SetConsent(...) if either consent wasn't required - or using the rules described here based on the determined purpose consent status.

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

@batteredhedgehog
Copy link
Author

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
Copy link

binouze commented Apr 15, 2024

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
Copy link

Remstam commented Apr 18, 2024

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
Copy link

Bump

@binouze
Copy link

binouze commented Apr 23, 2024

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
Copy link

Any updates?

@WBoda
Copy link

WBoda commented May 15, 2024

up

@argzdev
Copy link

argzdev commented May 15, 2024

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
Copy link

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests