-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: Ensure has_marketing_consent user trait are correctly set and sent after participateInMetaMetrics is set to true #29871
Merged
+240
−16
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Builds ready [a7887e3]
Page Load Metrics (1721 ± 86 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
f0b123a
to
f082f6f
Compare
5ff1ff4
to
2d5dd49
Compare
Builds ready [2d5dd49]
Page Load Metrics (1794 ± 71 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [a4a3cb0]
Page Load Metrics (1847 ± 94 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
DDDDDanica
previously approved these changes
Jan 30, 2025
7 tasks
NidhiKJha
previously approved these changes
Jan 31, 2025
6ca1707
to
c30995d
Compare
51e0c13
to
89a899e
Compare
89a899e
to
61e0601
Compare
DDDDDanica
previously approved these changes
Feb 5, 2025
Builds ready [e7f67d5]
Page Load Metrics (1749 ± 97 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [95087c2]
Page Load Metrics (1497 ± 49 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
QA manual testing passed ! |
DDDDDanica
approved these changes
Feb 6, 2025
NidhiKJha
approved these changes
Feb 6, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-attribution
QA Passed
release-12.13.0
Issue or pull request that will be included in release 12.13.0
team-extension-platform
Extension Platform team
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It was observed in production metrics that the
has_marketing_consent
user trait was not set (eithernull
orundefined
) for 40-50% of users. Meanwhile, another ~40% of users had it set to false, and the remainder had it set to true.The problem was in the metametrics controller. The controller sets
state.previousUserTraits
in the_buildUserTraitsObject
function, which gets called when there are state updates. That function also usesstate.previousUserTraits
to determine which values need to be returned, by comparing it to the newcurrentTraits
.The problem is that if a trait is set while
participateInMetaMetrics
is false, then the trait will not be sent in a request to Segment, BUT the trait will be saved instate.previousUserTraits
. Later, ifparticipateInMetaMetrics
is set to true,_buildUserTraitsObject
will not return a trait currently matchesstate.previousUserTraits
The
has_marketing_consent
trait is set to true when the user checks the associated checkbox on the metametrics screen of the onboarding flow, but then if the user clicks confirm/yes on that screen to opt-in to metametrics, the aforementioned problem is hit.To solve this, we just ensure that
state.previousUserTraits
is not saved ifparticipateInMetaMetrics
is false.Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3932
Manual testing steps
has_marketing_consent
is set to true--
has_marketing_consent
is set to true--
has_marketing_consent
is set to false. If the marketing consent toggle is turned on, there should then be a network request where the user trait is trueImportant
This requires manual test from QA.
Screenshots/Recordings
Copy.text.Untitled.Project.mp4
Pre-merge author checklist
Pre-merge reviewer checklist