MetaMask / MetaMask/metamask-mobile
fix(analytics): fix user traits types violations
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
Segment schema violation for the following user traits in identify calls:
- traits.security_providers: Invalid type. Expected: array, given: string
- traits.has_marketing_consent: Invalid type. Expected: boolean, given: string
### Scenario
_No response_
### Design
_No response_
### Technical Details
Update traits types to be
- traits.security_providers: array of provider strings -> `['blockaid']` or `[]` see https://github.com/MetaMask/metamask-mobile/blob/refactor/22017_common_analytics_controller/app/util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData.ts#L44-L45
- traits.has_marketing_consent: boolean -> https://github.com/MetaMask/metamask-mobile/blob/refactor/22017_common_analytics_controller/app/util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData.ts#L46-L49
### Threat Modeling Framework
_No response_
### Acceptance Criteria
- no more schema violations reported on these traits
### 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] Data
### References
- https://github.com/Consensys/segment-schema/blob/409a0172b09fe4d29b14f98762edb39a4159dcb4/tracking-plans/metamask-mobile.yaml#L39
- https://github.com/Consensys/segment-schema/blob/409a0172b09fe4d29b14f98762edb39a4159dcb4/tracking-plans/metamask-mobile.yaml#L51
Contributor guide
Research direction
Start with app/util/metrics/UserSettingsAnalyticsMetaData/generateUserProfileAnalyticsMetaData.ts and inspect the user profile metadata generation around the referenced traits. Compare the emitted values with the segment-schema definitions for metamask-mobile.yaml, then verify that security_providers is an array and has_marketing_consent is a boolean so these schema violations no longer occur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100