chore(homepage): add homepage section viewed segment event#26529
chore(homepage): add homepage section viewed segment event#26529vinnyhoward merged 22 commits intomainfrom
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. |
app/components/Views/Homepage/hooks/useHomepageSectionViewedEvent.ts
Outdated
Show resolved
Hide resolved
app/components/Views/Homepage/Sections/Predictions/PredictionsSection.tsx
Outdated
Show resolved
Hide resolved
…tmcu-465-homepage-section-viewed-segment-event
…tmcu-465-homepage-section-viewed-segment-event
…ate, and scroll throttle
…tmcu-465-homepage-section-viewed-segment-event
… github.com:MetaMask/metamask-mobile into feat-tmcu-465-homepage-section-viewed-segment-event
| * In the `useFocusEffect` cleanup (blur), walk up the navigator tree and record | ||
| * the Tab navigator's active-tab index. After a tab-press the Tab state has | ||
| * already updated to the new tab's index (≠ 0 for Home); after a back-navigation | ||
| * or modal dismiss within the Home tab the index stays 0. |
There was a problem hiding this comment.
This hook determines why the Homepage gained focus on each visit
APP_OPENEDHOME_TABNAVIGATED_BACK
by snapshotting the Tab navigator's active-tab index on blur and comparing it on the next focus.
… from new changes on main
…tmcu-465-homepage-section-viewed-segment-event
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.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection Rationale:
The changes are primarily analytics-focused and don't modify core business logic, but they do add new state management (scroll context), refs, and props to multiple components. The risk is medium because while the changes are additive (analytics tracking), they touch the core wallet view and multiple feature sections. Performance Test Selection: |
The committed fixture schema is out of date. To update, comment: |
|



Description
Implements the
Homepage Section ViewedSegment event for the redesigned homepage. The new homepage renders content as stacked sections (Tokens, Perps, Predictions, DeFi, NFTs) rather than the old tab view, and product requires visibility tracking for each section.What changed:
HOMEPAGE_SECTION_VIEWED1 ('Homepage Viewed') toMetaMetrics.events.ts`HomepageScrollContext— bridges scroll position from the parentScrollViewinWalletdown to section components via a subscription pattern (ref-based, no React state updates on scroll to avoid re-renders)useHomepageSectionViewedEventhook — usesmeasureInWindow()to detect 50% viewport visibility, fires once per homepage visit, resets on each focus viavisitIdWallet/index.tsxto provide scroll context, viewport height, andentry_pointdetection (app_opened,home_tab,navigated_back)Homepage.tsxto compute per-section indices based on enabled feature flagsSegment Event PR: https://github.com/Consensys/segment-schema/pull/477
Changelog
CHANGELOG entry: null
Related issues
Fixes: TMCU-465
Manual testing steps
Screenshots/Recordings
App Opened
app_opened.mov
Navigated Back
navigated_back.mov
Home Tab
home_tab.mov
Before
~After
~Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds new scroll-driven analytics instrumentation to
Wallet/homepage sections, which can affect event firing accuracy and scroll performance if mis-measured or over-triggered. Changes are mostly additive but touch the main wallet screen render/scroll path and multiple section components/tests.Overview
Implements a new
MetaMetricsEvents.HOME_VIEWEDSegment event for the redesigned homepage, fired when a section reaches ≥50% viewport visibility and re-fired on each homepage visit with anentry_point.Adds
HomepageScrollContext+useHomepageEntryPointto provide scroll/viewport measurements, a throttled scroll subscription mechanism (no re-renders on scroll), and per-visitvisitIdfromWallet.Updates
Homepageand all section components (Tokens/Perps/Predict/DeFi/NFTs) to compute feature-flag-awaresectionIndex/totalSectionsLoaded, wrap content with measurableViewrefs, and calluseHomeViewedEventwith loading/empty/itemCount semantics; tests are expanded/adjusted accordingly (plus a smallDate.nowrestore inBridgeViewtests for debounce reliability).Written by Cursor Bugbot for commit 8c6d3ad. This will update automatically on new commits. Configure here.