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. |
| chain_id_source: getDecimalChainId(sourceToken.chainId), | ||
| token_symbol_source: sourceToken?.symbol, | ||
| token_address_source: sourceToken?.address, | ||
| from_trending: fromTrending ?? false, |
There was a problem hiding this comment.
The event for swaps already exists; i am adding a property "from_trending" to recognize if the user came from trending page
| { | ||
| screen: Routes.PERPS.MARKET_DETAILS, | ||
| params: { market: item as PerpsMarketData }, | ||
| params: { market: item as PerpsMarketData, source: 'trending' }, |
There was a problem hiding this comment.
Adding source "trending" for when user clicks on rowItem from the trendingFeed, or from ViewAllAction
| navigateToOrder({ | ||
| direction, | ||
| asset: market.symbol, | ||
| source, |
There was a problem hiding this comment.
passing down the source to PerpsOrderView
app/components/UI/Bridge/hooks/useSwapBridgeNavigation/index.ts
Outdated
Show resolved
Hide resolved
app/components/UI/Trending/services/TrendingFeedSessionManager.ts
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #23674 +/- ##
==========================================
+ Coverage 78.73% 78.74% +0.01%
==========================================
Files 4042 4043 +1
Lines 105606 105723 +117
Branches 21267 21292 +25
==========================================
+ Hits 83144 83248 +104
- Misses 16637 16641 +4
- Partials 5825 5834 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| interface PredictMarketProps { | ||
| market: PredictMarketType; | ||
| testID?: string; | ||
| entryPoint?: PredictEntryPoint; |
There was a problem hiding this comment.
If poss, can we revert this file change (we can reduce the number of CO files to review)
ca00a11
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes in this PR introduce a new TrendingFeedSessionManager service for tracking user sessions in the Trending Feed, along with analytics event tracking improvements across multiple features:
All changes are primarily analytics-related, adding tracking capabilities for when users navigate from the Trending Feed to other features (Perps, Predictions, Swaps/Bridge). The unit tests added cover the new TrendingFeedSessionManager service and update mocks in Predict component tests. Selected tags rationale:
|
|


Description
PR adds metrics for trending.
To test this i added logs where it should emit the events:
1️⃣ & 2️⃣ Trending Feed Session (Visits + Time Spent)
File: app/components/UI/Trending/services/TrendingFeedSessionManager.ts
3️⃣ Swap Volume from Trending
File: app/components/UI/Bridge/hooks/useSwapBridgeNavigation/index.ts
4️⃣ Perps Volume from Trending
File: app/components/UI/Perps/controllers/services/TradingService.ts
5️⃣ Predict Volume from Trending
File: app/components/UI/Predict/controllers/PredictController.ts
🧪 Test Scenarios
Test 1: Trending Feed Session
Navigate to Trending tab
Check: Log shows TRENDING_FEED_VIEWED with is_session_end: false
Wait 30 seconds
Navigate away OR background the app
Check: Log shows TRENDING_FEED_VIEWED with is_session_end: true, session_time: ~30
Test 2: Swap from Trending
Go to Trending → Click on a token card
On Token Details, click Swap
Check: Log shows from_trending: true
Test 3: Swap NOT from Trending
Go to Wallet → Click on any token
Click Swap
Check: Log shows from_trending: false
Test 4: Perps from Trending (Carousel)
Go to Trending → Click on a Perps market card in carousel
Click Long/Short → Place order
Check: Log shows source: "trending"
Test 5: Perps from Trending (QuickAction)
Go to Trending → Click Perps QuickAction button
Click on a market from the list
Click Long/Short → Place order
Check: Log shows source: "trending"
Test 6: Perps NOT from Trending
Go to Perps tab from home (not from Trending)
Click on start trading → Choose any crypto → Place order
Check: Log shows source: "none" or different source
Test 7: Predict from Trending
Go to Trending → Click on a Predict market card in carousel
Click Yes/No → Complete trade
Check: Log shows entryPoint: "trending"
Test 8: Predict NOT from Trending
Go to Predict tab directly
Click on a market → Complete trade
Check: Log shows entryPoint: "predict_feed"
Changelog
CHANGELOG entry: Adds metrics for trending feature
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds Trending Feed session analytics and propagates “from trending”/entry point to Swaps, Perps, and Predict events.
TrendingFeedSessionManagerto track sessions (start/end, app state) and emitsTRENDING_FEED_VIEWEDwithsession_id,session_time,is_session_end,entry_point.TRENDING_FEED_VIEWEDinMetaMetrics.events.Views/TrendingView.tsx(enable AppState listener, start/end session).useSwapBridgeNavigation, augmentsSWAP_BUTTON_CLICKEDwithfrom_trendingbased on active trending session.source: 'trending'inPerpsOrderViewwhen session active;TradingServiceincludessourceinPERPS_TRADE_TRANSACTION.TrackingDatawith optionalsource.entryPointtoENTRY_POINT.TRENDINGinPredictMarketSingle/PredictMarketMultipleand propagates via navigation (including market details); addsENTRY_POINT.TRENDINGto constants and types.TrendingFeedSessionManager.Written by Cursor Bugbot for commit ca00a11. This will update automatically on new commits. Configure here.