feat(perps): add MM Pay token metrics and cancel trade event tracking#27109
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
These are purely analytics additions with no functional changes to trading logic. The risk is low as the changes only add event tracking calls. However, since they touch the Perps feature, SmokePerps is required. Per tag dependencies, SmokeWalletPlatform (Perps is a section in Trending) and SmokeConfirmations (Add Funds deposits are on-chain transactions) should also be included. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
The committed fixture schema is out of date. To update, comment: |
|



Description
This PR adds comprehensive event tracking for MM Pay token metrics in the Perps trading flow. The changes include:
MM Pay Token Metrics Enhancement: When users trade using their Perps balance (instead of paying with a token), the
mm_pay_token_selectedproperty now includes the value'Perps Balance'in trade transaction events. This provides complete visibility into payment method selection, whether users pay with tokens or use their Perps balance.Cancel Trade with Token Event Tracking: Added event tracking for the cancel trade with token flow:
PERPS_UI_INTERACTIONevent withinteraction_type: 'cancel_trade_with_token'when the user cancels a tradePERPS_SCREEN_VIEWEDevent withscreen_type: 'cancel_trade_with_token_toast'when the "taking longer" toast is displayedThese metrics enable better analytics on user behavior, payment method preferences, and cancellation patterns in the Perps trading experience.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2616
Manual testing steps
Screenshots/Recordings
Before
N/A (analytics/metrics changes, no UI changes)
After
N/A (analytics/metrics changes, no UI changes)
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk: changes are limited to MetaMetrics analytics properties/events and associated constants/tests, with no changes to order execution behavior beyond emitting additional tracking calls.
Overview
Adds new Perps MetaMetrics tracking for the deposit+order cancellation flow: emits
PERPS_SCREEN_VIEWEDwhen the "deposit taking longer" cancel toast is shown andPERPS_UI_INTERACTIONwhen the user taps cancel.Extends
PERPS_TRADE_TRANSACTIONanalytics so whentrackingDatais present buttradeWithTokenis false,mm_pay_token_selectedis explicitly reported as"Perps Balance"(applied in bothusePerpsOrderExecutionandTradingService). Updates Perps event constants, tests, and the Perps metametrics reference docs accordingly.Written by Cursor Bugbot for commit 9a82c62. This will update automatically on new commits. Configure here.