-
Notifications
You must be signed in to change notification settings - Fork 185
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
MPP-3644: Add Mozilla accounts opt-out property to Profile and API #4392
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree we should add the front-end changes to this PR to land it all at once. If you want to time-box your own effort on it, I'd be happy to do it.
This returns False if the user has metricsEnabled=false on their Mozilla accounts profile, and True otherwise.
2a04d0b
to
bc63d5f
Compare
bc63d5f
to
12ef976
Compare
Use a singleton hook useGoogleAnalytics, default false, to control all the code that emits Google Analytics (GA) events. MyApp watches for metrics to load, and then, if enabled, runs initGoogleAnalytics to load the GA script, then set useGoogleAnalytics to true to refresh with the enabled event code. This updates useIsLoggedIn to return a string, 'unknown' while loading, and 'logged-in' / 'logged-out' once the profile API call is processed to determine the logged-in status. In a similar way, useMetrics returns 'unknown', 'enabled', and 'disabled'. This protects hooks from being called unnecessarily while the profile API is called and processed.
12ef976
to
2043ad3
Compare
@groovecoder I've added the frontend changes to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving without comment as this doesn't affect l10n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some blocking questions/comments/suggestions.
Spot-check looks good!
frontend/src/components/layout/navigation/whatsnew/WhatsNewDashboard.test.tsx
Show resolved
Hide resolved
Thanks for the review!
@groovecoder, back you |
The Metrics for Relying Parties - Opt-Opt section says:
For MPP-3644, this PR implements reading this value on the backend, and forwarding it via the API.
This also includes front-end changes to use this new signal to decide if we should load Google Analytics.
Testing
npm -w frontend install
to install the newreact-singleton-hook
dependencynpm -w frontend run watch
to build the frontend with debugging on./manage.py runserver
,"metrics_enabled": true
in the JSON response."metrics_enabled": false