Skip to content

feat: fix button label for action button clicked event cp-7.69.0#27117

Merged
sahar-fehri merged 2 commits into
mainfrom
fix/fix-buy-sell-event-labels
Mar 6, 2026
Merged

feat: fix button label for action button clicked event cp-7.69.0#27117
sahar-fehri merged 2 commits into
mainfrom
fix/fix-buy-sell-event-labels

Conversation

@sahar-fehri
Copy link
Copy Markdown
Contributor

@sahar-fehri sahar-fehri commented Mar 6, 2026

Description

The sticky Buy and Sell buttons on the token details page were both firing ACTION_BUTTON_CLICKED with button_label: "Swap", making it impossible to distinguish between the two actions in Mixpanel.
Changes:

  • Added an optional buttonLabel param to goToSwaps / goToNativeBridge in useSwapBridgeNavigation, falls back to "Swap" so all existing callers are unaffected
  • handleBuyPress now passes button_label: "Buy" and handleSellPress passes button_label: "Sell"

Changelog

CHANGELOG entry: updated event property for ACTION_BUTTON_CLICKED

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

Low Risk
Low risk: changes only analytics event properties by threading an optional buttonLabel through navigation helpers; swap/bridge navigation behavior is unchanged due to a default fallback.

Overview
Fixes token details Buy/Sell sticky buttons reporting ACTION_BUTTON_CLICKED with button_label: "Swap".

useSwapBridgeNavigation now accepts an optional buttonLabel in goToNativeBridge/goToSwaps and uses it for trackActionButtonClick (defaulting to the existing Swap label), and useTokenActions passes the correct localized Buy/Sell labels; tests were updated to assert the new arguments.

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

@sahar-fehri sahar-fehri requested review from a team as code owners March 6, 2026 09:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 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.

@sahar-fehri sahar-fehri changed the title feat: fix button label for action button clicked event feat: fix button label for action button clicked event cp-7.97.0 Mar 6, 2026
@sahar-fehri sahar-fehri changed the title feat: fix button label for action button clicked event cp-7.97.0 feat: fix button label for action button clicked event cp-7.69.0 Mar 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations, SmokeRamps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes add an optional buttonLabel parameter to the swap/bridge navigation hooks to improve analytics tracking. Specifically:

  1. useSwapBridgeNavigation: Added optional buttonLabel parameter to goToNativeBridge and goToSwaps functions, which customizes the button_label field in analytics events. Falls back to existing default if not provided.

  2. useTokenActions: Updated handleBuyPress and handleSellPress to pass 'Buy' and 'Sell' labels respectively when navigating to swaps, allowing analytics to distinguish between these actions.

  3. Test updates: Unit tests updated to verify the new parameter is passed correctly.

These are low-risk changes because:

  • The new parameter is optional with a sensible default
  • No functional behavior changes - only analytics tracking is affected
  • Changes are well-tested with updated unit tests

Selected tags:

  • SmokeTrade: The useSwapBridgeNavigation hook is central to swap/bridge flows, and the changes affect how swap navigation is triggered from token details
  • SmokeConfirmations: Required as a dependent tag when selecting SmokeTrade (swap flows include transaction confirmations)
  • SmokeRamps: The handleBuyPress and handleSellPress functions in useTokenActions are entry points for buy/sell flows, which relate to on-ramp/off-ramp functionality

Performance Test Selection:
These changes are purely analytics-related, adding an optional label parameter for tracking purposes. They do not affect UI rendering, data loading, state management, or any performance-critical paths. No performance tests are needed.

View GitHub Actions results

@sahar-fehri sahar-fehri enabled auto-merge March 6, 2026 11:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 6, 2026

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 68
Missing keys 11
Type mismatches 0
Value mismatches 7 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 6, 2026

@sahar-fehri sahar-fehri added this pull request to the merge queue Mar 6, 2026
Merged via the queue into main with commit 0e76ada Mar 6, 2026
94 checks passed
@sahar-fehri sahar-fehri deleted the fix/fix-buy-sell-event-labels branch March 6, 2026 12:28
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 6, 2026
@metamaskbot metamaskbot added the release-7.70.0 Issue or pull request that will be included in release 7.70.0 label Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.70.0 Issue or pull request that will be included in release 7.70.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants