Commit c60cf6d
chore(runway): cherry-pick feat: MUSD-454 add quick convert event tracking cp-7.70.0 (#27455)
- feat: MUSD-454 add quick convert event tracking (#27305)
<!--
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**
### Changes:
- Adds Segment event tracking for the mUSD Quick Convert flow
- Enriches generic `Transaction*` events for `musdConversion`
transactions
- Adds `confirmation_source` to differentiate between the "Max" convert
bottom sheet and custom amount confirmations
- Adds `is_max` which is `true` when "Max" conversion flow is used or
when custom amount is used and user clicks "Max" button in percentage
button row
- Adds mUSD quote tracking data
### Events
| Event | Type | Location | Description |
|---|---|---|---|
| `mUSD Quick Convert Screen Viewed` | New standalone event |
`MusdQuickConvertView` (on mount) | Fires when the quick convert token
list screen is viewed |
| `mUSD Bonus Terms of Use Pressed` | New standalone event |
`MusdQuickConvertView` (`quick_convert_home_screen`),
`EarnMusdConversionEducationView` (`conversion_education_screen`),
`useMusdConversionNavbar` (`custom_amount_navbar`), `PercentageRow`
(`percentage_row`) | Fires when user presses the bonus terms of use
link; `location` property differentiates the source |
| `mUSD Quick Convert Token Row Button Clicked` | New standalone event |
`MusdQuickConvertView` | Fires on "Max" or "Edit" button tap; includes
`button_action`, `redirects_to`, asset details |
| `confirmation_source` | New property on `Transaction*` events |
`useMusdConversionConfirmationMetrics` |
`'quick_convert_max_bottom_sheet_confirmation_screen'` or
`'custom_amount_screen'` — only attached to `musdConversion`
transactions |
| `is_max` | New property on `Transaction*` events |
`useMusdConversionConfirmationMetrics` | Derived from
`TransactionPayController.isMaxAmount` — only attached to
`musdConversion` transactions |
| Quote tracking data | New properties on `Transaction*` events |
`useMusdConversionConfirmationMetrics` | Standardized quote/pay data via
`getMusdConversionQuoteTrackingData` — only attached to `musdConversion`
transactions |
<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->
## **Changelog**
<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`
If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`
(This helps the Release Engineer do their job more quickly and
accurately)
-->
CHANGELOG entry: Added Segment event tracking for mUSD Quick Convert
flow and enrich generic Transaction* events for mUSD conversion
transactions
## **Related issues**
Fixes: [MUSD-454: Add segment events for Quick Convert
flow](https://consensyssoftware.atlassian.net/browse/MUSD-454)
## **Manual testing steps**
```gherkin
Feature: mUSD Quick Convert Segment event tracking
Scenario: user views the quick convert screen
Given user navigates to the mUSD Quick Convert screen
When the screen mounts
Then "mUSD Quick Convert Screen Viewed" event fires with location "quick_convert_home_screen"
Scenario: user taps Max on a token row
Given user is on the mUSD Quick Convert screen with convertible tokens
When user taps "Max" on a token row
Then "mUSD Quick Convert Token Row Button Clicked" event fires with button_action "max" and redirects_to "quick_convert_max_bottom_sheet_confirmation_screen"
Scenario: user taps Edit on a token row
Given user is on the mUSD Quick Convert screen with convertible tokens
When user taps the edit icon on a token row
Then "mUSD Quick Convert Token Row Button Clicked" event fires with button_action "custom" and redirects_to "custom_amount_screen"
Scenario: user taps "Terms apply" link on the quick convert screen
Given user is on a screen displaying the mUSD bonus "Terms apply" link
When user taps "Terms apply"
Then "mUSD Bonus Terms of Use Pressed" event fires with the location of the current screen
Scenario: user confirms a max mUSD conversion
Given user is on the max convert bottom sheet confirmation
When user taps "Convert"
Then "Transaction Approved" event includes confirmation_source "quick_convert_max_bottom_sheet_confirmation_screen", "is_max: true", and quote tracking data
Scenario: user confirms a custom amount mUSD conversion
Given user is on the custom amount conversion screen
When user taps "Convert"
Then "Transaction Approved" event includes confirmation_source "custom_amount_screen", "is_max: false"
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **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.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Adds new MetaMetrics events and confirmation-metric dispatches across
mUSD conversion/confirmation screens; while behavior is mostly
observational, it touches confirmations flow and transaction status
tracking and could affect analytics payloads or introduce unintended
side effects if hooks fire unexpectedly.
>
> **Overview**
> Adds **MetaMetrics tracking for the mUSD Quick Convert flow**,
including `MUSD_QUICK_CONVERT_SCREEN_VIEWED`,
`MUSD_QUICK_CONVERT_TOKEN_ROW_BUTTON_CLICKED` (Max/Edit), and
`MUSD_BONUS_TERMS_OF_USE_PRESSED` with location/context properties.
>
> Introduces a shared analytics utility
(`getMusdConversionQuoteTrackingData` + `deepSnakeCaseKeys`) and
refactors `useMusdConversionStatus` to use it when emitting
`MUSD_CONVERSION_STATUS_UPDATED`, standardizing quote-derived
properties.
>
> Enriches **confirmation metrics for `musdConversion`** by adding a new
`useMusdConversionConfirmationMetrics` hook (wired into
`MusdConversionInfoRoot`) that dispatches `confirmation_source`,
`is_max`, and select quote fields into `confirmationMetrics`. Tests are
updated/added accordingly, and `EVENT_LOCATIONS`/`MetaMetricsEvents` are
extended to support the new instrumentation.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6e2e686. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
[15edc39](15edc39)
Co-authored-by: Matthew Grainger <46547583+Matt561@users.noreply.github.com>1 parent 601822d commit c60cf6d
File tree
20 files changed
+1150
-158
lines changed- app
- components
- UI/Earn
- Views
- EarnMusdConversionEducationView
- MusdQuickConvertView
- constants/events
- hooks
- utils
- Views/confirmations
- components
- info
- custom-amount-info
- musd-conversion-info-root
- rows/percentage-row
- hooks/metrics
- core/Analytics
20 files changed
+1150
-158
lines changedLines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
662 | 667 | | |
663 | 668 | | |
664 | 669 | | |
665 | 670 | | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
666 | 681 | | |
667 | 682 | | |
668 | 683 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
319 | 328 | | |
320 | 329 | | |
321 | 330 | | |
| |||
Lines changed: 171 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
26 | 41 | | |
27 | 42 | | |
28 | 43 | | |
| |||
70 | 85 | | |
71 | 86 | | |
72 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
| |||
133 | 151 | | |
134 | 152 | | |
135 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
136 | 162 | | |
137 | 163 | | |
138 | 164 | | |
| |||
518 | 544 | | |
519 | 545 | | |
520 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
521 | 692 | | |
Lines changed: 69 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
76 | 83 | | |
77 | 84 | | |
78 | 85 | | |
| 86 | + | |
| 87 | + | |
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
| |||
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
107 | 126 | | |
108 | 127 | | |
109 | 128 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
114 | 148 | | |
115 | 149 | | |
116 | 150 | | |
| |||
129 | 163 | | |
130 | 164 | | |
131 | 165 | | |
132 | | - | |
| 166 | + | |
133 | 167 | | |
134 | 168 | | |
135 | 169 | | |
136 | 170 | | |
137 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
138 | 191 | | |
139 | 192 | | |
140 | 193 | | |
| |||
158 | 211 | | |
159 | 212 | | |
160 | 213 | | |
161 | | - | |
| 214 | + | |
162 | 215 | | |
163 | 216 | | |
164 | 217 | | |
| |||
246 | 299 | | |
247 | 300 | | |
248 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
249 | 310 | | |
250 | | - | |
| 311 | + | |
251 | 312 | | |
252 | 313 | | |
253 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | 283 | | |
290 | 284 | | |
291 | 285 | | |
| |||
0 commit comments