Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(runway): cherry-pick fix: metrics call during onboarding (#13226)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** - refactor track trackOnboarding calls to pass an event built with MetricsEventBuilder - pass the properties with MetricsEventBuilder.addProperties ## **Related issues** Fixes MetaMask/mobile-planning#2122 ## **Manual testing steps** ```gherkin Feature: track metrics during onboarding Scenario: user creates new wallet Given a freshly installed app And user opted in for metrics When user creates a new wallet And user enters a new password Then no 'TRACK event saved {"event": undefined, "properties": {}, "type": "track"}' log is visible And the "Wallet Setup Started", "Wallet Created" and "Wallet Setup Completed" log is visible Scenario: user imports wallet Given a freshly installed app And user opted in for metrics When user imports a wallet And user enters a new password Then no 'TRACK event saved {"event": undefined, "properties": {}, "type": "track"}' log is visible And the "Wallet Import Started", "Wallet Imported" and "Wallet Setup Completed" log is visible Scenario: user manually backs the wallet up Given a freshly installed app And user opted in for metrics And user created a new wallet When user saves SRP Then no 'TRACK event saved {"event": undefined, "properties": {}, "type": "track"}' log is visible And the "Wallet Security Started", "Manual Backup Initiated", "Phrase Revealed", "Phrase Confirmed" and "Wallet Security Completed" log is visible Scenario: user skips wallet backup Given a freshly installed app And user opted in for metrics And user created a new wallet When user skips SRP backup by touching "remind me later" Then no 'TRACK event saved {"event": undefined, "properties": {}, "type": "track"}' log is visible And the "Wallet Security Skip Initiated", "Wallet Security Skip Confirmed" and "Automatic Security Checks Prompt Viewed" log is visible ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** ``` INFO TRACK event saved {"event": undefined, "properties": {}, "type": "track"} ``` ### **After** examples of fixed event tracking ``` INFO TRACK event saved {"event": "Wallet Setup Started", "properties": {}, "type": "track"} INFO TRACK event saved {"event": "Wallet Created", "properties": {"biometrics_enabled": false}, "type": "track"} INFO TRACK event saved {"event": "Wallet Setup Completed", "properties": {"new_wallet": true, "wallet_setup_type": "new"}, "type": "track"} ``` ``` INFO TRACK event saved {"event": "Wallet Import Started", "properties": {}, "type": "track"} INFO TRACK event saved {"event": "Wallet Imported", "properties": {"biometrics_enabled": false}, "type": "track"} INFO TRACK event saved {"event": "Wallet Setup Completed", "properties": {"new_wallet": false, "wallet_setup_type": "import"}, "type": "track"} ``` ``` INFO TRACK event saved {"event": "Wallet Security Skip Initiated", "properties": {}, "type": "track"} INFO TRACK event saved {"event": "Wallet Security Skip Confirmed", "properties": {}, "type": "track"} INFO TRACK event saved {"event": "Automatic Security Checks Prompt Viewed", "properties": {"applicationVersion": "7.37.1", "currentBuildNumber": "1520", "deviceBrand": "Apple", "operatingSystemVersion": "18.2", "platform": "ios"}, "type": "track"} INFO TRACK event saved {"event": "Wallet Security Reminder Dismissed", "properties": {"source": "Backup Alert", "wallet_protection_required": false}, "type": "track"} ``` ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: sethkfman <[email protected]>
- Loading branch information