Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions app/components/UI/AssetOverview/AssetOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import { selectTronResourcesBySelectedAccountGroup } from '../../../selectors/as
import { createStakedTrxAsset } from './utils/createStakedTrxAsset';
///: END:ONLY_INCLUDE_IF
import { getDetectedGeolocation } from '../../../reducers/fiatOrders';
import { useRampsButtonClickData } from '../Ramp/hooks/useRampsButtonClickData';

interface AssetOverviewProps {
asset: TokenI;
Expand Down Expand Up @@ -171,7 +172,7 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({

const currentAddress = asset.address as Hex;
const { goToBuy } = useRampNavigation();

const rampsButtonClickData = useRampsButtonClickData();
const { data: prices = [], isLoading } = useTokenHistoricalPrices({
asset,
address: currentAddress,
Expand Down Expand Up @@ -340,18 +341,23 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
assetId = undefined;
}

goToBuy({ assetId });

trackEvent(
createEventBuilder(MetaMetricsEvents.BUY_BUTTON_CLICKED)
createEventBuilder(MetaMetricsEvents.RAMPS_BUTTON_CLICKED)
.addProperties({
text: 'Buy',
location: 'TokenDetails',
chain_id_destination: getDecimalChainId(chainId),
ramp_type: 'BUY',
region: rampGeodetectedRegion,
ramp_routing: rampsButtonClickData.ramp_routing,
is_authenticated: rampsButtonClickData.is_authenticated,
preferred_provider: rampsButtonClickData.preferred_provider,
order_count: rampsButtonClickData.order_count,
})
.build(),
);

goToBuy({ assetId });
};

const goToBrowserUrl = (url: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const mockEventBuilder = {
jest.mock('../../hooks/useMetrics', () => ({
useMetrics: jest.fn(),
MetaMetricsEvents: {
BUY_BUTTON_CLICKED: 'buy_button_clicked',
RAMPS_BUTTON_CLICKED: 'ramps_button_clicked',
},
}));
Expand Down
4 changes: 0 additions & 4 deletions app/components/UI/BalanceEmptyState/BalanceEmptyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ const BalanceEmptyState: React.FC<BalanceEmptyStateProps> = ({
const handleAction = () => {
goToBuy();

trackEvent(
createEventBuilder(MetaMetricsEvents.BUY_BUTTON_CLICKED).build(),
);

trackEvent(
createEventBuilder(MetaMetricsEvents.RAMPS_BUTTON_CLICKED)
.addProperties({
Expand Down
Loading
Loading