Skip to content

feat: add provider_onramp property to Ramps Transaction Completed/Failed events#25618

Merged
amitabh94 merged 3 commits intomainfrom
add-provider-onramp-to-deposit-analytics
Feb 6, 2026
Merged

feat: add provider_onramp property to Ramps Transaction Completed/Failed events#25618
amitabh94 merged 3 commits intomainfrom
add-provider-onramp-to-deposit-analytics

Conversation

@amitabh94
Copy link
Copy Markdown
Contributor

@amitabh94 amitabh94 commented Feb 4, 2026

Description

This PR adds the provider_onramp property to the "Ramps Transaction Completed" and "Ramps Transaction Failed" analytics events for deposit/native orders.

Problem:
The Ramps Transaction Completed event does not have the provider_onramp property, while the On-ramp Purchase Completed event does have this field. When creating a custom Mixpanel event that combines both events for analysis, (not set) dominates the results because of the larger volume of native orders without this property.

Solution:

  • Added provider_onramp: string field to RampsTransactionCompleted and RampsTransactionFailed analytics interfaces
  • Updated getDepositAnalyticsPayload function to include provider_onramp from order.provider (defaults to empty string if not present)
  • Updated mock data to include provider field
  • Updated all test expectations to include provider_onramp property

This aligns the deposit/native orders analytics with the aggregator orders which already have provider_onramp, allowing for better analysis in Mixpanel custom events.

Files Changed:

  • app/components/UI/Ramp/Deposit/types/analytics.ts - Added provider_onramp to interfaces
  • app/components/UI/Ramp/Deposit/utils/getDepositAnalyticsPayload.ts - Added property extraction from order.provider
  • app/components/UI/Ramp/Deposit/testUtils/constants.ts - Updated mock data
  • app/components/UI/Ramp/Deposit/utils/getDepositAnalyticsPayload.test.ts - Updated all test expectations

Changelog

CHANGELOG entry: null

Related issues

Refs: Issue created in Slack from a message
Related PR: Consensys/segment-schema#447 (adds provider_onramp to Segment tracking plan)

Manual testing steps

Feature: Analytics event tracking for deposit orders

  Scenario: Deposit order completion includes provider_onramp property
    Given a deposit order is completed successfully
    When the Ramps Transaction Completed event is tracked
    Then the event should include the provider_onramp property with the provider name (e.g., "TRANSAK", "MOONPAY")
    
  Scenario: Deposit order failure includes provider_onramp property
    Given a deposit order fails
    When the Ramps Transaction Failed event is tracked
    Then the event should include the provider_onramp property with the provider name

Note: Manual testing requires completing a real deposit order (requires funds). Unit tests verify the property is correctly included in analytics payloads (11/11 tests pass).

Screenshots/Recordings

Before

N/A - Analytics change only

After

N/A - Analytics change only

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs and MetaMask Mobile Coding Standards.
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable (all 11 unit tests pass, verifying provider_onramp property inclusion)
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR (see labeling guidelines). 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.

Note

Low Risk
Low risk: analytics-only payload/type changes for deposit completion/failure events; main risk is downstream consumers expecting the previous schema.

Overview
Adds provider_onramp to deposit analytics for RAMPS_TRANSACTION_COMPLETED and RAMPS_TRANSACTION_FAILED, populating it from order.provider (defaulting to an empty string when missing).

Updates the corresponding TypeScript analytics event interfaces plus deposit test fixtures and unit test expectations to validate the new field is emitted.

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

…led events

- Add provider_onramp field to RampsTransactionCompleted and RampsTransactionFailed analytics interfaces
- Include provider_onramp in getDepositAnalyticsPayload function from order.provider
- Update mock data to include provider field
- Update all test expectations to include provider_onramp property

This aligns the deposit/native orders analytics with the aggregator orders which already have provider_onramp, allowing for better analysis in Mixpanel custom events.

Co-authored-by: Cursor <cursoragent@cursor.com>
@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-money-movement issues related to Money Movement features label Feb 4, 2026
@github-actions github-actions bot added the size-S label Feb 4, 2026
@amitabh94 amitabh94 marked this pull request as ready for review February 5, 2026 00:10
@amitabh94 amitabh94 requested a review from a team as a code owner February 5, 2026 00:10
@amitabh94 amitabh94 added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Feb 5, 2026
@amitabh94
Copy link
Copy Markdown
Contributor Author

amitabh94 commented Feb 5, 2026

SonarCloud Quality Gate Failure - Expected

The SonarCloud quality gate is failing due to new_coverage being 66.7% (below 80% threshold). This is expected because:

  • Type definition files (analytics.ts) and mock data files (constants.ts) are counted as "new code" with 0% coverage, but contain no executable code
  • The actual executable code (getDepositAnalyticsPayload.ts) has 90% statements, 71% branches, 90% lines coverage

@amitabh94 amitabh94 enabled auto-merge February 5, 2026 23:20
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 5, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: 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 are focused on adding a new provider_onramp field to the analytics payload for Ramp/Deposit transactions. This is a purely analytics-related change that:

  1. Adds provider_onramp field to RampsTransactionCompleted and RampsTransactionFailed analytics interfaces
  2. Updates getDepositAnalyticsPayload.ts to include the provider information in the analytics payload
  3. Updates test constants and unit tests to reflect the new field

The changes are additive and don't modify any user-facing functionality or transaction flows. The unit tests have been updated to cover the new analytics field. While the risk is low, selecting SmokeRamps provides a safety net to verify that the on-ramp/deposit flows still work correctly with the analytics changes, especially since analytics events are validated in some E2E tests.

Performance Test Selection:
These changes are purely analytics-related, adding a new field to track the on-ramp provider in analytics payloads. There is no impact on UI rendering, data loading, app startup, or any performance-critical paths. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Feb 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
66.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@amitabh94 amitabh94 added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit 13c9688 Feb 6, 2026
70 of 72 checks passed
@amitabh94 amitabh94 deleted the add-provider-onramp-to-deposit-analytics branch February 6, 2026 00:01
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
@metamaskbot metamaskbot added the release-7.66.0 Issue or pull request that will be included in release 7.66.0 label Feb 6, 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-S skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants