-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: update metrics logic #10545
fix: update metrics logic #10545
Conversation
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. |
Test do not pass yet on purpose We have to validate the test use case logic and then update implementation
19ddd75
to
aed7e26
Compare
5bb5551
to
5531e93
Compare
Add new type Keep legacy compatibility
and adjust tests
73aff4f
to
75cb230
Compare
…-mobile into 1886_metametrics_logic
Bitrise❌❌❌ Commit hash: 148d7c0 Note
|
thanks copilot!
Bitrise✅✅✅ Commit hash: 7f1cce6 Note
|
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.
Looks good! Nice work
add comment format
Quality Gate passedIssues Measures |
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.
Awesome work! LGTM!
Bitrise✅✅✅ Commit hash: 64e5a39 Note
|
I wish we would have kept the I'm proposing we just do a wrapper in trackAnonymousEvent(event, params) {
return this.trackEvent(event, { sensitiveProperties: ...params });
} Open to hear what you think @NicolasMassart edit: I also think obscuring |
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.
Nice :)
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.
LGTM. In interest of fixing this bug my suggestion will be discussed later in time.
Description
This PR fixes the logic for the Metametrics anonymous events handling.
What's in this PR:
trackAnonymousEvent
and migrate all calls totrackEvent
with newEventProperties
data structureJsonMap
Note
in a follow-up work we will work on refactoring of the events, completely get rid of legacy and only use
EventProperties
data structure, make events similar to extension.But this PR focuses on the anonymous event tracking logic. There's already some changes making it closer to how extension works, but only on the anonymous tracking part.
Related issues
Fixes https://github.com/MetaMask/mobile-planning/issues/1886
Fixes #9996
Manual testing steps
Run the app (simulator is fine)
and do an action that tracks anonymously, for instance request swap quotes.
It should show in the logs:
The regular non-anonymous event (name but no props)
The anonymous event (name and props)
Other pairs:
Quotes Requested:
Quotes Received:
Only two events should be sent, one non-anonymous (with distinct user id), one anonymous (with anonymous 0x000...000 id).
However, to check the IDs are correctly set, you have to go on Segment debug dashboard:
Non-anonymous event (see user id is random UUID):
Same event but as anonymous event (see user id is
0x0000000000000000
):For cases where you have only one non-anonymous tracking call, no anonymous event should be sent.
For instance on errors:
or on browser view:
matrix of tracking use cases based on extension behaviour.
it's also retro compatible with our individual anonymous events.
How to read it? Here are some examples:
The result must be only one non-anonymous event without any props (EMPTY) and no anonymous event at all (NONE).
The result must be a non-anonymous event with non-anonymous props (NA PROPS) and an anonymous event with all props (NA PROPS + A PROPS).
For C0/C1/C2:
prop = { anonymous: true, value: 'anon value' }
prop = 'anon value'
but are grouped in an object implementing the SensitiveProperties interface.Screenshots/Recordings
Before
No change on UI
After
No change on UI
Pre-merge author checklist
Pre-merge reviewer checklist