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

feat(analytics): add consent mode v2 #12298

Merged
merged 18 commits into from
Mar 20, 2024

Conversation

matinzd
Copy link
Contributor

@matinzd matinzd commented Feb 7, 2024

Description

Adding consent mode v2 to firebase analytics.

Reference: https://developers.google.com/tag-platform/security/guides/app-consent

Related Issues

Fixes #12148

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See [Contributor Guide]).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the [Flutter Style Guide].
  • I signed the [CLA].
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@matinzd matinzd changed the title feat(analytics, android): add consent mode v2 feat(analytics, android & ios): add consent mode v2 Feb 7, 2024
@matinzd matinzd changed the title feat(analytics, android & ios): add consent mode v2 feat(analytics): add consent mode v2 Feb 7, 2024
@russellwheatley
Copy link
Member

Thanks for the PR, @matinzd. As mentioned in the issue: #12148, we're discussing internally the shape of the API before rolling out 👍

@matinzd
Copy link
Contributor Author

matinzd commented Feb 7, 2024

I cannot run the example app since there is something wrong with the pod install.
Although pod install succeeds, FirebaseAnalytics and GoogleAppMeasurement pod folder is empty.

Screenshot 2024-02-07 at 15 29 40

Pod install log:

Analyzing dependencies
firebase_analytics: Using Firebase SDK version '10.20.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.20.0' defined in 'firebase_core'
Downloading dependencies
Installing FirebaseAnalytics 10.20.0
Installing GoogleAppMeasurement 10.20.0
Generating Pods project
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 12 total pods installed.

Build log:

Semantic Issue (Xcode): Use of undeclared identifier 'FIRAnalytics'
Semantic Issue (Xcode): Use of undeclared identifier 'FIRConsentTypeAnalyticsStorage'
...

@matinzd matinzd marked this pull request as ready for review February 7, 2024 15:05
@matinzd
Copy link
Contributor Author

matinzd commented Feb 12, 2024

Updated cocoapods and the example app is now working. For some reasons, the pods where not being copied to the corresponding folder. Example app with works both on iOS and Android.

@matinzd matinzd force-pushed the feat/consent_mode_v2 branch 2 times, most recently from 84685a5 to bc049af Compare February 19, 2024 10:33
@matinzd
Copy link
Contributor Author

matinzd commented Feb 19, 2024

Any updates? @russellwheatley

@russellwheatley
Copy link
Member

@matinzd - not as such. Will let you know when it has been decided 👍

@shanelic
Copy link

@matinzd - not as such. Will let you know when it has been decided 👍

Is there an estimated time for the decision to approve the PR?

@matinzd matinzd force-pushed the feat/consent_mode_v2 branch 2 times, most recently from ed8567d to 98d7993 Compare March 1, 2024 12:04
@Sese-Schneider
Copy link
Contributor

@matinzd thank you already for your effort implementing this!
Are you also aiming to provide the functionallity to FlutterFire WEB with this PR? https://firebase.google.com/docs/reference/js/analytics#setconsent_1697027

@matinzd
Copy link
Contributor Author

matinzd commented Mar 4, 2024

@Sese-Schneider

IMO, it's better to merge iOS and Android first and then have the web implemented in a separate PR. For now, it seems like it's not a priority at all as this PR is officially one month old and all of our campaigns paused due to this being a blocker for us.

Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just need to pipe through the additional web consents and then I'll see what else needs to be updated, if anything 👍

@matinzd
Copy link
Contributor Author

matinzd commented Mar 12, 2024

I am gonna adjust the PR tonight. Thanks for the feedback!

@russellwheatley
Copy link
Member

@matinzd - we are looking to get this released next week, let me know if you have the time to complete, if not, I can take over. Thanks 😄

@matinzd
Copy link
Contributor Author

matinzd commented Mar 15, 2024

Hey!
Will update it tonight.

Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we could get this done by some point tomorrow at the latest so we can include it in the latest release. Thanks

@matinzd
Copy link
Contributor Author

matinzd commented Mar 19, 2024

Fixed some formatting issues. Can you rerun the workflows @russellwheatley ?

@nitinrgadhiya
Copy link

nitinrgadhiya commented Mar 20, 2024

@matinzd

FYI, I copied your code from PR.

I've enabled 4 consents in the Firebase analytics code but in the "Verbose" log I can see only 3 consents granted. I did not see "adPersonalization" consent property.

Do you know why?

How to enable a verbose log you can check this link?

image

Can you please check from your end, if it works fine? do you have any suggestion where I made mistake?

@matinzd
Copy link
Contributor Author

matinzd commented Mar 20, 2024

Which consent is missing in verbose log? @nitinrgadhiya

@nitinrgadhiya
Copy link

adPersonalization

@matinzd

@matinzd
Copy link
Contributor Author

matinzd commented Mar 20, 2024

I couldn't find any issues with adPersonalizationSignalsConsentGranted key. It seems everything is in order. Keys are being properly passed into the platform method channel and on the native side, we have the same key as well. I am feeling that it's not showing up in the verbose log or it's just a user property which you can see in the log.

@nitinrgadhiya
Copy link

I couldn't find any issues with adPersonalizationSignalsConsentGranted key. It seems everything is in order. Keys are being properly passed into the platform method channel and on the native side, we have the same key as well. I am feeling that it's not showing up in the verbose log or it's just a user property which you can see in the log.

yes, I agree with what you say ("about key passed properly."). And if your feeling is right, then It's okay.
Thanks for quick response. @matinzd

@matinzd
Copy link
Contributor Author

matinzd commented Mar 20, 2024

@russellwheatley ?

Copy link
Member

@russellwheatley russellwheatley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@russellwheatley
Copy link
Member

Hey @matinzd - I just realised the integration tests are failing and need updating here: https://github.com/firebase/flutterfire/blob/master/tests/integration_test/firebase_analytics/firebase_analytics_e2e_test.dart#L211-L228

Update to this should work:

test(
      'setConsent',
      () async {
        await expectLater(
          FirebaseAnalytics.instance.setConsent(
            analyticsStorageConsentGranted: true,
            adStorageConsentGranted: true,
            adPersonalizationSignalsConsentGranted: true,
            adUserDataConsentGranted: true,
            functionalityStorageConsentGranted: true,
            personalizationStorageConsentGranted: true,
            securityStorageConsentGranted: true,
          ),
          completes,
        );
      },
    );

@russellwheatley russellwheatley self-requested a review March 20, 2024 13:26
removed expecting unimplemented
@matinzd
Copy link
Contributor Author

matinzd commented Mar 20, 2024

Fixed. If anything else popped up, feel free to push to the branch 👍

@russellwheatley russellwheatley merged commit 19f3dbd into firebase:master Mar 20, 2024
16 of 18 checks passed
@Lyokone
Copy link
Contributor

Lyokone commented Mar 20, 2024

Thanks a lot @matinzd for helping with this, really appreciated :D

@matinzd matinzd deleted the feat/consent_mode_v2 branch March 20, 2024 16:03
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 5, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 5, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 5, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 5, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 16, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
LocLt-Mobile pushed a commit to guide-inc-org/guide-flutter_fire that referenced this pull request Apr 16, 2024
Co-authored-by: matin-zadeh-dolatabad <matin.zadeh.dolatabad@schibsted.com>
Co-authored-by: Guillaume Bernos <guillaume.bernos@gmail.com>
Co-authored-by: Guillaume Bernos <guillaume@bernos.dev>
@firebase firebase locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [firebase_analytics] Implement consent mode v2
6 participants