chore(runway): cherry-pick feat(predict): cp-7.63.0 add game properties to analytics events#25123
Conversation
…es to analytics events (#25065) ## **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](Consensys/segment-schema#429). ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: - https://consensyssoftware.atlassian.net/browse/PRED-422 - https://consensyssoftware.atlassian.net/browse/PRED-505 ## **Manual testing steps** ```gherkin 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** - [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] > 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 `initiated` → `success`/`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 > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 4c8b0b8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
|
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. |
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.63.0) All E2E tests pre-selected. |
| } else if (result.action === Share.dismissedAction) { | ||
| // Dismissed | ||
| } else { | ||
| throw new Error('Failed to share'); |
There was a problem hiding this comment.
Share dismissal incorrectly tracked as failure
Medium Severity
When a user intentionally dismisses the share dialog (cancels without sharing), the code now throws an error and tracks it as PredictShareStatus.FAILED. The original code specifically handled Share.dismissedAction separately from failures, treating it as a normal user action requiring no tracking. User cancellation is semantically different from an actual failure—this conflates intentional user behavior with system errors, causing inflated failure rates in analytics. Additionally, on Android Share.share() always returns sharedAction (platform limitation), so dismissals there would track as SUCCESS, creating cross-platform inconsistency.
|
|
No release label on PR. Adding release label release-7.63.0 on PR, as PR was cherry-picked in branch 7.63.0. |


Description
Add new analytics properties to Predict market events to improve
tracking for sports/game-based prediction markets:
PREDICT_MARKET_DETAILS_OPENED and PREDICT_TRADE_TRANSACTION
events now include:
market_slug- Market slug identifiergame_id- Game identifiergame_start_time- Game start timestampgame_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)SHARE_ACTION event tracking added for share button interactions:
status- Share status: "initiated", "success", or "failed"market_id- Market identifiermarket_slug- Market slugThese changes align with the Segment schema updates in segment-schema
PR #429.
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
N/A - Analytics only change, no UI modifications
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
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 sharing flows.
market_slug,game_id,game_start_time,game_league,game_status,game_period,game_clocktoPREDICT_TRADE_TRANSACTIONandPREDICT_MARKET_DETAILS_OPENEDviaPredictController, with type updates inproviders/types.tsPredictShareStatusand newSHARE_ACTIONtracking inPredictController.trackShareActionPredictShareButtonto sendSHARE_ACTIONevents on press (initiated) and on result (success/failed), and accept/passmarketSlug; propagates prop from market detail/game viewsWritten by Cursor Bugbot for commit 7040a85. This will update automatically on new commits. Configure here.
a2d49c6