metametrics tracks too many events
What is this about?
MetaMetrics trackEvents sends too many events in some cases.
It's like it's doing both anonymous and non anonymous tracking at the same time, resulting in 3 events instead of 1.
Example:
Onboaring phase: when not checking marketing checkbox
INFO TRACK event saved {"event": "Terms of Use Shown", "properties": {}, "type": "track"}
INFO IDENTIFY event saved {"traits": {"Batch account balance requests": "ON", "Enable OpenSea API": "ON", "NFT Autodetection": "OFF", "Theme": "light", "applicationVersion": "7.23.0", "currentBuildNumber": "1333", "deviceBrand": "Apple", "is_metrics_opted_in": true, "operatingSystemVersion": "17.5", "platform": "ios", "security_providers": "blockaid", "token_detection_enable": "ON"}, "type": "identify", "userId": "19f4001c-68a6-4b62-9f1d-d8f6ff92718e"}
INFO TRACK event saved {"event": "Wallet Setup Started", "properties": {}, "type": "track"}
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {"is_metrics_opted_in": true, "location": "onboarding_metametrics", "updated_after_onboarding": false}, "type": "track"}
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {"is_metrics_opted_in": true, "location": "onboarding_metametrics", "updated_after_onboarding": false}, "type": "track"}
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {}, "type": "track"}
INFO TRACK event saved {"event": "Welcome Message Viewed", "properties": {}, "type": "track"}
INFO TRACK event saved {"event": "Onboarding Started", "properties": {}, "type": "track"}
INFO Sent 1 events
INFO Sent 7 events
We should not have so many "Analytics Preference Selected" events, 1 and 2 seems to be an anonymous and a non-anonymous events (not sure of the order, 1 and 2 may be reverted).
But if we consider they are in the right order, in the following, event 2 is wrong and should not exist as the event was sent using trackEvent and not trackAnonymousEvent. See app/components/UI/OptinMetrics/index.js onConfirm()
1: this is an anonymous event (UUID Zero), properly not showing in user events
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {"is_metrics_opted_in": true, "location": "onboarding_metametrics", "updated_after_onboarding": false}, "type": "track"}
2: event with props, should be anonymous (UUID Zero) but it's not, showing up in user (see screenshot first event)
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {"is_metrics_opted_in": true, "location": "onboarding_metametrics", "updated_after_onboarding": false}, "type": "track"}
3: anonymous event (no props), see second event in screenshot
INFO TRACK event saved {"event": "Analytics Preference Selected", "properties": {}, "type": "track"}
Scenario
No response
Design
No response
Technical Details
No response
Threat Modeling Framework
No response
Acceptance Criteria
- clarify and document the reason for this behaviour
- fix and document it if necessary
Stakeholder review needed before the work gets merged
- [X] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [X] Other (please specify)
- @worldlyjohn Data team
References
See @worldlyjohn comment on this PR https://github.com/MetaMask/metamask-mobile/pull/9905#issuecomment-2155321704
In the example Analytics Preference Selected there's no need to trigger an anonymous event, right? Only the non-anonymous event should be triggered.
Already refined by @NicolasMassart. The findings are listed in the description section. removing the needs refinement label
Hi @NicolasMassart ,
- Was this issue fixed by this PR you made?
- Can this issue somehow be related with this new sev1 issue we discovered this week?
Will come back to this once the sev1 above is fixed. If a refactor is done around the anonymous event, there may be a chance that this is addressed as well. Moving to backlog