Skip to content

feat(predict): cp-7.65.0 add analytics tracking to deposit flow#25670

Merged
matallui merged 2 commits intomainfrom
predict/track-deposit
Feb 5, 2026
Merged

feat(predict): cp-7.65.0 add analytics tracking to deposit flow#25670
matallui merged 2 commits intomainfrom
predict/track-deposit

Conversation

@caieu
Copy link
Copy Markdown
Contributor

@caieu caieu commented Feb 4, 2026

Description

Add analytics event tracking when deposit is triggered from different
entry points (homepage balance, buy preview). The deposit function now
accepts optional analytics parameters including entryPoint and amountUsd.

  • Add trackPredictOrderEvent call in usePredictDeposit when analytics
    properties are provided
  • Pass HOMEPAGE_BALANCE entry point from PredictBalance component
  • Pass BUY_PREVIEW entry point with market context from usePredictPlaceOrder
    when balance is insufficient
  • Add new event values: BUY_PREVIEW entry point and transaction types
    for deposit, withdraw, and claim
  • Update tests to verify analytics properties are passed correctly

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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

Medium Risk
Touches the deposit initiation path and changes the deposit hook API to accept parameters, which could break callers or alter deposit triggering behavior if mis-wired; analytics additions are otherwise low impact.

Overview
Adds analytics instrumentation to the Predict deposit flow by extending usePredictDeposit.deposit to accept optional { amountUsd, analyticsProperties } and emitting PredictController.trackPredictOrderEvent with status: initiated and transactionType: mm_predict_deposit when provided.

Threads the new analytics context through key entry points: PredictBalance passes entryPoint: homepage_balance for the Add Funds button, and usePredictPlaceOrder triggers a deposit on insufficient BUY balance while passing amountUsd, entryPoint: buy_preview, and market context (merging any existing orderParams.analyticsProperties). Event constants are expanded with BUY_PREVIEW and new transaction type values, and tests are updated/added to assert the new analytics payloads and tracking behavior.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 4, 2026

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.

@metamaskbot metamaskbot added the team-predict Predict team label Feb 4, 2026
@github-actions github-actions bot added the size-M label Feb 4, 2026
@caieu caieu marked this pull request as ready for review February 5, 2026 18:57
@caieu caieu requested a review from a team as a code owner February 5, 2026 18:57
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.

@caieu caieu changed the title feat(predict): add analytics tracking to deposit flow feat(predict): cp-7.65.0 add analytics tracking to deposit flow Feb 5, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 5, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: @PerformancePredict
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on adding analytics tracking to the Predict (Polymarket) deposit flow. Specifically:

  1. PredictBalance.tsx: Now passes analytics properties (entryPoint: HOMEPAGE_BALANCE) when calling deposit() from the Add Funds button
  2. usePredictDeposit.ts: Enhanced to accept optional analytics parameters and track deposit initiation events via PredictController.trackPredictOrderEvent()
  3. usePredictPlaceOrder.ts: Passes analytics properties (marketId, entryPoint: BUY_PREVIEW) when triggering deposit due to insufficient balance
  4. eventNames.ts: Added new event values for BUY_PREVIEW entry point and deposit/withdraw/claim transaction types

These are analytics-only changes that don't modify core business logic. The deposit function signature change is backward compatible (optional parameters). All changes are well-covered by updated unit tests.

Tag selection rationale:

  • SmokePredictions: Primary tag - directly tests Polymarket prediction market integration including deposit flows
  • SmokeWalletPlatform: Required per SmokePredictions description - "Predictions is also a section inside the Trending tab"
  • SmokeConfirmations: Required per SmokePredictions description - deposits are on-chain transactions that go through confirmations

Performance Test Selection:
The changes affect the Predict deposit flow, which is explicitly covered by @PerformancePredict (covers 'deposit flows, and balance display'). While the changes are primarily analytics-focused and unlikely to cause performance regressions, running the performance test provides validation that the added analytics tracking doesn't introduce any latency in the deposit flow.

View GitHub Actions results

@caieu caieu enabled auto-merge February 5, 2026 22:20
@matallui matallui disabled auto-merge February 5, 2026 22:27
@matallui matallui enabled auto-merge February 5, 2026 22:27
@matallui matallui added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit fa7d510 Feb 5, 2026
157 of 159 checks passed
@matallui matallui deleted the predict/track-deposit branch February 5, 2026 22:46
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
@metamaskbot metamaskbot added the release-7.66.0 Issue or pull request that will be included in release 7.66.0 label Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants