Skip to content

Commit

Permalink
feat(ramp): add fields to event
Browse files Browse the repository at this point in the history
  • Loading branch information
wachunei committed Feb 28, 2024
1 parent 52e419d commit b0dca32
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/components/UI/Ramp/Views/Quotes/Quotes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ describe('Quotes', () => {
"currency_destination": "ETH",
"currency_source": "USD",
"payment_method_id": "/payment-methods/test-payment-method",
"previously_used_count": 0,
"provider_onramp_first": "Banxa (Staging)",
"provider_onramp_list": Array [
"Banxa (Staging)",
"MoonPay (Staging)",
"Transak (Staging)",
],
"refresh_count": 1,
"results_count": 3,
},
]
`);
Expand Down
11 changes: 11 additions & 0 deletions app/components/UI/Ramp/Views/Quotes/Quotes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ function Quotes() {
const payload = {
payment_method_id: selectedPaymentMethodId as string,
amount: params.amount,
refresh_count: appConfig.POLLING_CYCLES - pollingCyclesLeft,
results_count: filteredQuotes.length,
provider_onramp_first: filteredQuotes[0]?.provider?.name,
provider_onramp_list: filteredQuotes.map(({ provider }) => provider.name),
previously_used_count: filteredQuotes.filter(({ provider }) =>
ordersProviders.includes(provider.id),
).length,
};
if (isBuy) {
trackEvent('ONRAMP_QUOTES_EXPANDED', {
Expand All @@ -257,10 +264,14 @@ function Quotes() {
});
}
}, [
appConfig.POLLING_CYCLES,
filteredQuotes,
isBuy,
ordersProviders,
params.amount,
params.asset?.symbol,
params.fiatCurrency?.symbol,
pollingCyclesLeft,
selectedChainId,
selectedPaymentMethodId,
trackEvent,
Expand Down
3 changes: 3 additions & 0 deletions app/components/UI/Ramp/types/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ interface RampQuotesExpanded {
currency_source: string;
currency_destination: string;
amount: number | string;
refresh_count: number;
results_count: number;
previously_used_count: number;
}

interface OnRampQuotesExpanded extends RampQuotesExpanded {
Expand Down

0 comments on commit b0dca32

Please sign in to comment.