Skip to content

feat(predict): cp-7.63.0 add game properties to analytics events#25065

Merged
matallui merged 4 commits intomainfrom
predict/game-metrics
Jan 23, 2026
Merged

feat(predict): cp-7.63.0 add game properties to analytics events#25065
matallui merged 4 commits intomainfrom
predict/game-metrics

Conversation

@matallui
Copy link
Copy Markdown
Contributor

@matallui matallui commented Jan 22, 2026

Description

Add new analytics properties to Predict market events to improve tracking for sports/game-based prediction markets:

  1. PREDICT_MARKET_DETAILS_OPENED and PREDICT_TRADE_TRANSACTION events now include:

    • market_slug - Market slug identifier
    • game_id - Game identifier
    • game_start_time - Game start timestamp
    • game_league - League name (e.g., "NBA", "NFL")
    • game_status - Game status (e.g., "not_started", "live", "final")
    • game_period - Current game period (nullable)
    • game_clock - Current game clock (nullable)
  2. SHARE_ACTION event tracking added for share button interactions:

    • status - Share status: "initiated", "success", or "failed"
    • market_id - Market identifier
    • market_slug - Market slug

These changes align with the Segment schema updates in segment-schema PR #429.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: Predict Analytics Events

  Scenario: Game properties sent on market details view
    Given user navigates to a sports prediction market
    When user opens the market details view
    Then PREDICT_MARKET_DETAILS_OPENED event includes game properties (game_id, game_league, game_status, etc.)

  Scenario: Game properties sent on trade transaction
    Given user is on a sports prediction market buy/sell preview
    When user completes a buy or sell transaction
    Then PREDICT_TRADE_TRANSACTION event includes game properties

  Scenario: Share action tracking
    Given user is viewing a prediction market with game details
    When user taps the share button
    Then SHARE_ACTION event is sent with status "initiated"
    And when share completes successfully, SHARE_ACTION event is sent with status "success"
    And when share fails, SHARE_ACTION event is sent with status "failed"

Screenshots/Recordings

N/A - Analytics only change, no UI modifications

Pre-merge author checklist

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

Enhances Predict analytics coverage for sports markets and share interactions.

  • Extends PREDICT_TRADE_TRANSACTION and PREDICT_MARKET_DETAILS_OPENED with market_slug, game_id, game_start_time, game_league, game_status, game_period, game_clock
  • Adds PredictController.trackShareAction and wires PredictShareButton to track initiatedsuccess/failed (includes market_id and optional market_slug)
  • Passes marketSlug into PredictShareButton in market/game detail views
  • Updates analytics types/interfaces to carry new fields across controller/provider layers
  • Adds unit tests for share button analytics, URL/message construction, and edge cases

Written by Cursor Bugbot for commit 4c8b0b8. This will update automatically on new commits. Configure here.

- Add market_slug, game_id, game_start_time, game_league, game_status,
  game_period, and game_clock properties to PREDICT_MARKET_DETAILS_OPENED
  and PREDICT_TRADE_TRANSACTION events
- Add SHARE_ACTION event tracking with status (initiated/success/failed),
  market_id, and market_slug properties
- Update PredictController with trackShareAction method
- Pass game properties through Buy/Sell preview flows
- Add analytics tracking to PredictShareButton component
- Add tests for share button analytics tracking
@metamaskbot metamaskbot added the team-predict Predict team label Jan 22, 2026
@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.

@matallui matallui changed the title feat(predict): add game properties to analytics events feat(predict): cp-7.63.0 add game properties to analytics events Jan 22, 2026
@matallui matallui added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Jan 22, 2026
@matallui matallui marked this pull request as ready for review January 22, 2026 22:04
@matallui matallui requested a review from a team as a code owner January 22, 2026 22:04
cursor[bot]

This comment was marked as outdated.

- Update dismissed share test to expect FAILED tracking
- Add call count and SUCCESS verification for undefined marketSlug test
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

All changes are confined to the app/components/UI/Predict/ directory and focus exclusively on:

  1. Analytics enhancements: Adding new tracking properties for live sports markets (gameId, gameStartTime, gameLeague, gameStatus, gamePeriod, gameClock, marketSlug) to existing analytics events
  2. New share action tracking: Adding a trackShareAction method to PredictController and integrating it into PredictShareButton to track share initiated/success/failed events
  3. Unit tests: Adding comprehensive tests for the new share analytics functionality

The changes are:

  • Self-contained within the Predict feature module
  • Non-breaking (adding optional properties to existing interfaces)
  • Analytics-focused (no changes to core business logic or user flows)
  • Well-tested with new unit tests

The PredictController is marked as CRITICAL because it contains "Controller" in the name, but the actual changes are minimal analytics additions that don't affect the core prediction functionality. No changes to navigation, shared components, or other features.

SmokePredictions is the appropriate tag as it tests "Polymarket prediction market integration" including "opening new positions on available markets" and "the Positions tab for viewing all open positions" - which would exercise the modified components (PredictMarketDetails, PredictBuyPreview, PredictSellPreview).

View GitHub Actions results

Copy link
Copy Markdown

@cursor cursor bot left a comment

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.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
8.9% Coverage on New Code (required ≥ 80%)
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copy link
Copy Markdown
Contributor

@caieu caieu left a comment

Choose a reason for hiding this comment

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

Lgtm

@matallui matallui added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit a2d49c6 Jan 23, 2026
89 of 90 checks passed
@matallui matallui deleted the predict/game-metrics branch January 23, 2026 17:46
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2026
@metamaskbot metamaskbot added the release-7.64.0 Issue or pull request that will be included in release 7.64.0 label Jan 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.64.0 Issue or pull request that will be included in release 7.64.0 size-M skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants