Skip to content

Conversation

@AxelGes
Copy link
Contributor

@AxelGes AxelGes commented Jul 17, 2025

Description

This PR adds analytics tracking for Transaction related events. (Confirmed, Completed, Failed)

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

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.

@github-actions
Copy link
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.

@metamaskbot metamaskbot added the team-ramp issues related to Ramp features label Jul 17, 2025
@AxelGes AxelGes marked this pull request as ready for review July 17, 2025 21:37
@AxelGes AxelGes requested a review from a team as a code owner July 17, 2025 21:37
@AxelGes AxelGes added No QA Needed Apply this label when your PR does not need any QA effort. Run Smoke E2E labels Jul 17, 2025
@github-actions
Copy link
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: a3fd8bf
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/da676a14-eb34-40d7-8915-514588319433

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: cb9fafc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/63b35ded-49a3-4507-a069-6bd3cb5905d7

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 17, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: d744471
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/27550280-89cb-49be-99f5-5c16f57d4fd9

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 18, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: e0f8a6a
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/15a254fc-3026-40a8-a0a4-92b251548886

Note

  • You can rerun any failed steps by opening the Bitrise build, tapping Rebuild on the upper right then Rebuild unsuccessful Workflows
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@socket-security
Copy link

socket-security bot commented Jul 18, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​consensys/​native-ramps-sdk@​1.0.12 ⏵ 1.1.0100 +14100100 +1100 +3100 +20

View full report

Copy link

@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.

Bug: Unnecessary Dependencies Cause Duplicate Analytics Events

The useEffect hook responsible for tracking RAMPS_TRANSACTION_COMPLETED and RAMPS_TRANSACTION_FAILED analytics events has an overly broad dependency array. It includes navigation and orderId, which are not used within the effect's analytics logic, and depends on the entire order object. This causes the effect to re-run unnecessarily and fire duplicate analytics events whenever these dependencies change, even if the order's completion or failure state has not changed.

app/components/UI/Ramp/Deposit/Views/OrderProcessing/OrderProcessing.tsx#L87-L146

useEffect(() => {
if (!order) return;
const isCompleted = order.state === FIAT_ORDER_STATES.COMPLETED;
const isFailed = order.state === FIAT_ORDER_STATES.FAILED;
if (isCompleted || isFailed) {
if (hasDepositOrderField(order.data, 'cryptoCurrency')) {
const cryptoCurrency = getCryptoCurrencyFromTransakId(
(order.data as DepositOrder).cryptoCurrency,
);
const baseAnalyticsData = {
ramp_type: 'DEPOSIT' as const,
amount_source: Number(order.data.fiatAmount),
amount_destination: Number(order.cryptoAmount),
exchange_rate: Number(order.data.exchangeRate),
payment_method_id: order.data.paymentMethod,
country: selectedRegion?.isoCode || '',
chain_id: cryptoCurrency?.chainId || '',
currency_destination:
selectedWalletAddress || order.data.walletAddress,
currency_source: order.data.fiatCurrency,
};
if (isCompleted) {
trackEvent('RAMPS_TRANSACTION_COMPLETED', {
...baseAnalyticsData,
gas_fee: order.data.networkFees
? Number(order.data.networkFees)
: 0,
processing_fee: order.data.partnerFees
? Number(order.data.partnerFees)
: 0,
total_fee: Number(order.data.totalFeesFiat),
});
} else if (isFailed) {
trackEvent('RAMPS_TRANSACTION_FAILED', {
...baseAnalyticsData,
gas_fee: order.data.networkFees
? Number(order.data.networkFees)
: 0,
processing_fee: order.data.partnerFees
? Number(order.data.partnerFees)
: 0,
total_fee: Number(order.data.totalFeesFiat),
error_message: order.data.statusDescription || 'transaction_failed',
});
}
}
}
}, [
order,
navigation,
orderId,
trackEvent,
selectedWalletAddress,
selectedRegion,
]);

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@github-actions
Copy link
Contributor

github-actions bot commented Jul 18, 2025

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: da6370b
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/731fd52c-ee38-44a4-a492-b092db9f9d06

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@sonarqubecloud
Copy link

@georgeweiler georgeweiler enabled auto-merge July 18, 2025 23:03
@georgeweiler georgeweiler added this pull request to the merge queue Jul 18, 2025
Merged via the queue into main with commit 1393baa Jul 18, 2025
56 of 58 checks passed
@georgeweiler georgeweiler deleted the feat/deposit/transactions-analytics branch July 18, 2025 23:26
@github-actions github-actions bot locked and limited conversation to collaborators Jul 18, 2025
@metamaskbot metamaskbot added the release-7.53.0 Issue or pull request that will be included in release 7.53.0 label Jul 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.53.0 Issue or pull request that will be included in release 7.53.0 team-ramp issues related to Ramp features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants