-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: adds "data collection for marketing" toggles #24605
Conversation
…sk/metamask-extension into jb-opt-in-metrics
…k-extension into jb-opt-in-metrics
…mask-extension into jb-opt-in-metrics
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
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.
@NidhiKJha you will need to render the new onboarding screen, right now it's hidden through the privacy policy date. Just make the |
ui/store/actions.ts
Outdated
return (dispatch: MetaMaskReduxDispatch) => { | ||
log.debug(`background.setDataCollectionForMarketing`); | ||
return new Promise((resolve, reject) => { | ||
callBackgroundMethod<string>( |
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.
This function is deprecated, please use submitRequestToBackground
instead
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.
Fixed
ui/store/actions.ts
Outdated
(err, metaMetricsId) => { | ||
log.debug(err); | ||
if (err) { | ||
dispatch(displayWarning(err)); |
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.
displayWarning
is deprecated, please find some other way of handling this error. This method will display the error totally out of context in random places in the app, and it'll stick around for a seemingly arbitrary amount of time. Bad UX.
Once this is converted to use submitRequestToBackground
, this error variable won't be here unless we add a try...catch
block to catch it. We may or may not want to do that, depending on when we expect this to fail.
If it should never fail, I'd recommend not catching the error and letting it bubble up to the global error handler to be captured by Sentry.
If we'd expect it to fail sometimes, then we should catch it. If the failure condition is relevant to the user (e.g. if an operation failed and the user should be informed), then we'll have to think about where in the UI to best display this error. Maybe easiest to throw here and catch it in a UI component where we can show the error.
If we expect it to fail sometimes in a way that isn't important to a user, then we can just log the error to the console and move on.
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.
Fixed
ui/store/actions.ts
Outdated
* changed. The logic to determine which way to toggle is in the | ||
* toggleSession handler in setupSentry.js. | ||
*/ | ||
window.sentry?.toggleSession(); |
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.
This doesn't seem necessary; this toggle doesn't impact Sentry. Only the overall meta metrics toggle impacts Sentry.
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.
Fixed
@@ -162,6 +163,12 @@ export default function reduceMetamask(state = initialState, action) { | |||
participateInMetaMetrics: action.value, | |||
}; | |||
|
|||
case actionConstants.SET_DATA_COLLECTION_FOR_MARKETING: |
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.
What is this for? Generally we shouldn't adding anything to this Redux slice, it's meant as a mirror of the background state. The actions here other than the background state update action are all examples of technical debt that we have not cleaned up yet.
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.
This is to mirror the implementation of SET_PARTICIPATE_IN_METAMETRICS. We are adding the marketing toggle flag to the state as well (dataCollectionForMarketing)
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.
This seems like a misunderstanding. SET_PARTICIPATE_IN_METAMETRICS
shouldn't be here either
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.
These are good points, and these changes will be postponed for a later date given our time constraints. Both SET_PARTICIPATE_IN_METAMETRICS and SET_DATA_COLLECTION_FOR_MARKETING should be deleted from the redux state.
Builds ready [e27aef2]
Page Load Metrics (49 ± 4 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #24605 +/- ##
===========================================
- Coverage 65.64% 65.60% -0.04%
===========================================
Files 1362 1362
Lines 54189 54265 +76
Branches 14112 14127 +15
===========================================
+ Hits 35572 35600 +28
- Misses 18617 18665 +48 ☔ View full report in Codecov by Sentry. |
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.
Marking as RC until Mark's item is addressed: #24605 (review)
Builds ready [0dc9878]
Page Load Metrics (46 ± 5 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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.
I think I tested all combinations successfully.
- New user:
- metrics off, marketing off
- metrics on, marketing off
- metrics on, marketing on
- existing user:
- metrics off (don't see modal)
- metrics on, marketing off
- metrics on, marketing on
Just make sure we resolve this slack thread to be sure nothing is broken:
https://consensys.slack.com/archives/C06VBTL358A/p1718150795110559
Adds data collection for marketing toggles (and toasts/warnings) on:
Description
Related issues
Fixes:
https://github.com/MetaMask/MetaMask-planning/issues/2437
https://github.com/MetaMask/MetaMask-planning/issues/2438
https://github.com/MetaMask/MetaMask-planning/issues/2526
Manual testing steps
Onboarding checkbox:
Make the
metametrics.js
to returnrenderOnboarding
instead ofrenderLegacyOnboarding
Security tab:
true
, the "Participate in MetaMetrics" toggle should turn totrue
false
, "Data collection for marketing" should be set tofalse
true
and "Data collection for marketing" istrue
, and the latter is set tofalse
, a warning message should appear.Toast:
An already onboarded user will have the "dataCollectionForMarketing" value as
null
(neithertrue
orfalse
). This will trigger the toast.true
.false
.All of these actions should trigger subsequent Segment events.
Screenshots/Recordings
Before
After
demo2.mp4
Pre-merge author checklist
Pre-merge reviewer checklist