Skip to content

feat(predict): instrument Predict World Cup analytics#30322

Merged
caieu merged 4 commits into
mainfrom
predict/PRED-878-predict-world-cup-instrument-world-cup-feed-tabs-banner-and-deep-link-analytics
May 20, 2026
Merged

feat(predict): instrument Predict World Cup analytics#30322
caieu merged 4 commits into
mainfrom
predict/PRED-878-predict-world-cup-instrument-world-cup-feed-tabs-banner-and-deep-link-analytics

Conversation

@caieu

@caieu caieu commented May 18, 2026

Copy link
Copy Markdown
Contributor

Description

Implements analytics instrumentation for the Predict World Cup experience so the Predict team can measure World Cup feed engagement and entry point performance during the tournament.

This PR:

  • Adds MetaMetrics events and Predict analytics/controller trackers for:
    • Predict World Cup Screen Viewed
    • Predict World Cup Screen Tab Changed
    • Predict World Cup Banner Viewed
    • Predict World Cup Banner Clicked
  • Tracks the dedicated World Cup screen view with entry_point and the resolved initial predict_feed_tab.
  • Tracks World Cup screen tab changes with entry_point and selected predict_feed_tab.
  • Tracks main Predict feed World Cup banner impressions and clicks with entry_point: predict_feed.
  • Preserves existing deep link attribution behavior, including utm_source suffixes such as deeplink_twitter.
  • Keeps the main Predict feed World Cup tab on the existing Predict Feed Viewed session analytics path through PredictFeedSessionManager.

Companion Segment schema changes are expected in segment-schema for the four new mobile events. No new mobile analytics property keys are introduced.

Changelog

CHANGELOG entry: null

Related issues

Fixes: PRED-878

Manual testing steps

Feature: Predict World Cup analytics

  Scenario: user opens the World Cup screen from the main Predict feed banner
    Given Predict World Cup is enabled
    And the main Predict feed banner is visible

    When user views the banner
    Then analytics emits "Predict World Cup Banner Viewed" with entry_point "predict_feed"

    When user taps the banner
    Then analytics emits "Predict World Cup Banner Clicked" with entry_point "predict_feed"
    And the World Cup screen opens
    And analytics emits "Predict World Cup Screen Viewed" with entry_point "predict_feed"

  Scenario: user opens the World Cup screen from a deep link
    Given Predict World Cup is enabled

    When user opens a Predict deep link with feed "world-cup", tab "live", and utm_source "twitter"
    Then the World Cup screen opens on the "live" tab
    And analytics emits "Predict World Cup Screen Viewed" with entry_point "deeplink_twitter"
    And analytics includes predict_feed_tab "live"

  Scenario: user changes tabs on the World Cup screen
    Given the World Cup screen is open

    When user selects a different World Cup tab
    Then analytics emits "Predict World Cup Screen Tab Changed"
    And analytics includes the selected predict_feed_tab

Screenshots/Recordings

N/A. Analytics instrumentation only; no user-facing visual changes.

Before

N/A

After

N/A

Automated testing

  • yarn jest app/components/UI/Predict/controllers/PredictAnalytics.test.ts app/components/UI/Predict/controllers/PredictController.test.ts app/components/UI/Predict/components/PredictWorldCupMainFeedBanner/PredictWorldCupMainFeedBanner.test.tsx app/components/UI/Predict/views/PredictWorldCup/PredictWorldCup.test.tsx app/components/UI/Predict/services/PredictFeedSessionManager.test.ts app/core/DeeplinkManager/handlers/legacy/__tests__/handlePredictUrl.test.ts
  • yarn generate-method-action-types
  • yarn prettier --check on touched files
  • git diff --check

Note: yarn lint:tsc was run and failed on unrelated existing Bridge, Trending, transaction-pay, and delegation type errors outside this change.

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Medium Risk
Adds new Predict analytics event plumbing and emits tracking calls from the World Cup banner/screen flows, which could affect metrics accuracy and slightly impacts navigation params/session logic.

Overview
Adds World Cup-specific analytics instrumentation across Predict, including a new MetaMetrics event PREDICT_BANNER_ACTION and corresponding PredictAnalytics.trackBannerAction/PredictController.trackBannerAction wiring.

Extends PREDICT_FEED_VIEWED tracking to optionally include predict_screen, and updates the World Cup screen to generate a session id, default entryPoint to predict_feed, emit an initial trackFeedViewed once availability is resolved, and track tab changes as additional feed views (ignoring presses on the active tab).

Updates the main feed World Cup banner to emit a one-time-per-mount viewed event plus a clicked event on press, and passes entryPoint: predict_feed into World Cup navigation; deep link tests also verify preserving utm_source attribution in the entryPoint value.

Reviewed by Cursor Bugbot for commit cfaafb7. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-predict Predict team label May 18, 2026
@github-actions github-actions Bot added pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-M labels May 18, 2026
@caieu caieu marked this pull request as ready for review May 18, 2026 15:06
@caieu caieu requested review from a team as code owners May 18, 2026 15:06
Comment thread app/components/UI/Predict/services/PredictFeedSessionManager.test.ts Outdated
@matallui matallui removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 18, 2026
chrisleewilcox
chrisleewilcox previously approved these changes May 18, 2026
Cal-L
Cal-L previously approved these changes May 18, 2026

@Cal-L Cal-L left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platform LGTM

@caieu caieu changed the title feat: instrument Predict World Cup analytics feat(predict): instrument Predict World Cup analytics May 18, 2026
matallui
matallui previously approved these changes May 18, 2026
caieu added 3 commits May 19, 2026 13:47
Add MetaMetrics and Predict analytics/controller trackers for World Cup screen views, screen tab changes, banner views, and banner clicks.

Track World Cup screen entry attribution with the resolved initial tab, track tab changes from the dedicated World Cup screen, and track main feed banner impressions/clicks with predict_feed attribution.

Cover the new analytics paths with controller, analytics, banner, screen, deeplink attribution, and feed-session regression tests.
@caieu caieu dismissed stale reviews from matallui, Cal-L, and chrisleewilcox via 2aa617b May 19, 2026 16:54
@caieu caieu force-pushed the predict/PRED-878-predict-world-cup-instrument-world-cup-feed-tabs-banner-and-deep-link-analytics branch from c150c15 to 2aa617b Compare May 19, 2026 16:54
matallui
matallui previously approved these changes May 19, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2aa617b. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR adds analytics tracking for the Predict World Cup feature:

  1. New trackBannerAction method added to PredictController and PredictAnalytics for tracking banner viewed/clicked events
  2. New PREDICT_BANNER_ACTION MetaMetrics event added
  3. PredictWorldCupMainFeedBanner now tracks banner view (on mount) and click events
  4. PredictWorldCup view now tracks feed session start and tab change events with trackFeedViewed
  5. New event constants/values added (BANNER_TYPE, ACTION_TYPE, PREDICT_SCREEN)
  6. Engine mock updated in tests/component-view/mocks.ts to include the new method

These are additive analytics changes scoped to the Predictions feature. The changes touch PredictController (a critical controller file) but only add new methods without modifying existing behavior. The MetaMetrics.events.ts change is purely additive.

SmokePredictions is selected as the primary tag since changes directly affect Predictions views and analytics.
Per SmokePredictions tag description: also select SmokeWalletPlatform (Trending section) and SmokeConfirmations (on-chain transactions).
No other tags are warranted as the changes are isolated to the Predict feature analytics layer.

Performance Test Selection:
The changes are purely analytics additions - new event tracking calls in existing UI components. No rendering performance changes, no new data loading, no list rendering modifications, no startup/initialization changes. The analytics calls are lightweight fire-and-forget operations that won't meaningfully impact performance metrics.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@caieu caieu enabled auto-merge May 19, 2026 20:52
@caieu caieu added this pull request to the merge queue May 20, 2026
Merged via the queue into main with commit c5f1ee5 May 20, 2026
140 of 144 checks passed
@caieu caieu deleted the predict/PRED-878-predict-world-cup-instrument-world-cup-feed-tabs-banner-and-deep-link-analytics branch May 20, 2026 12:34
@github-actions github-actions Bot locked and limited conversation to collaborators May 20, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-M team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants