chore: update AI insights tracking#27851
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. |
<!-- 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** This PR adds a segment event to track when the Market Insights card comes into view. This is necessary because at the moment it always renders below the fold, making it arduous to get good CTR data for the Market Insights feature. This adds a useful, intermediate step in the funnel. https://github.com/user-attachments/assets/f6267a60-300d-4aaf-831e-970af5f43743 <!-- 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: null ## **Related issues** Fixes: ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **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 a new visibility-detection hook that uses a 250ms polling interval until the card is visible, which could impact performance or battery if misapplied. Other changes are additive analytics property updates with low functional risk. > > **Overview** > Adds a new `MARKET_INSIGHTS_CARD_SCROLLED_TO_VIEW` analytics event that fires once when the Market Insights entry card becomes at least 50% visible, using a new `useViewportTracking` hook (layout + short polling) and wiring it into `MarketInsightsEntryCard`. > > Extends Market Insights telemetry to include `asset_symbol` on `MARKET_INSIGHTS_OPENED`, `MARKET_INSIGHTS_VIEWED`, and `MARKET_INSIGHTS_INTERACTION` events (token + perps contexts), with updated unit tests to assert the new properties and event emission. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4407c73. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27851 +/- ##
==========================================
+ Coverage 82.56% 82.60% +0.03%
==========================================
Files 4825 4837 +12
Lines 123955 124392 +437
Branches 27617 27730 +113
==========================================
+ Hits 102346 102753 +407
- Misses 14560 14575 +15
- Partials 7049 7064 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e6c286a
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: 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.
|
✅ E2E Fixture Validation — Schema is up to date |
|




Description
Adds
asset_symbolproperty to the following tracking events:Adds
Market Insights Card Scrolled to Viewevent.This is necessary to make it easier to identify the assets in Mixpanel.
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Mostly analytics/tracing changes, but it alters
useMarketInsightsstate reset behavior and gatesMARKET_INSIGHTS_VIEWEDemission onreportAssetId, which could affect when the Market Insights screen renders/tracks during fast asset switches.Overview
Adds richer Market Insights analytics by attaching
asset_symboland APIdigest_idtoMARKET_INSIGHTS_OPENED,MARKET_INSIGHTS_VIEWED, andMARKET_INSIGHTS_INTERACTIONacross token and perps entry points.Introduces a new
MARKET_INSIGHTS_CARD_SCROLLED_TO_VIEWevent fired when the entry card becomes visible, and enhancesuseViewportTrackingwithmeasureInWindow-based polling plus a new Sentry trace (MarketInsightsViewportTracking) that recordsmeasure_callsand whether it resolved via visibility vs unmount.Updates
useMarketInsightsto exposereportAssetIdand to clearreport/reportAssetIdon (re)fetch;MarketInsightsViewnow avoids sending VIEWED analytics for stale reports whenassetIdentifierchanges before fresh data arrives. Also bumps@metamask/ai-controllersto^0.6.0and updates tests accordingly.Written by Cursor Bugbot for commit 8bd8607. This will update automatically on new commits. Configure here.