From de419ec3b2a8434418f38b1d03364076e0571117 Mon Sep 17 00:00:00 2001 From: rohit-gupta001 Date: Sun, 4 Aug 2024 16:40:30 +0530 Subject: [PATCH] fix event tracking: wallet page [Fixes #13420] --- src/components/CardList.tsx | 8 +++++++- src/pages/wallets/index.tsx | 41 ++++++++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/src/components/CardList.tsx b/src/components/CardList.tsx index ad0e7c490b7..6fc297f1377 100644 --- a/src/components/CardList.tsx +++ b/src/components/CardList.tsx @@ -13,6 +13,7 @@ import { import { BaseLink } from "@/components/Link" +import { MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo" import * as url from "@/lib/utils/url" import { useRtlFlip } from "@/hooks/useRtlFlip" @@ -102,12 +103,14 @@ export type CardListProps = BoxProps & { items: CardProps[] imageWidth?: number clickHandler?: (idx: string | number) => void + customEventOptions?: MatomoEventOptions } const CardList = ({ items, imageWidth, clickHandler = () => null, + customEventOptions, ...props }: CardListProps) => ( @@ -122,7 +125,10 @@ const CardList = ({ ) : ( clickHandler(idx)} + onClick={() => { + customEventOptions && trackCustomEvent(customEventOptions) + clickHandler(idx) + }} mb={4} {...listItem} /> diff --git a/src/pages/wallets/index.tsx b/src/pages/wallets/index.tsx index ea99dd72eba..abb792098c3 100644 --- a/src/pages/wallets/index.tsx +++ b/src/pages/wallets/index.tsx @@ -170,18 +170,18 @@ const WalletsPage = () => { href: "/wallets/find-wallet/", content: t("page-wallets-find-wallet-link"), matomo: { - eventCategory: "wallet hero buttons", + eventCategory: "Header buttons", eventAction: "click", - eventName: "find wallet", + eventName: "Find_wallet", }, }, { href: `#${SIMULATOR_ID}`, content: "How to use a wallet", matomo: { - eventCategory: "wallet hero buttons", + eventCategory: "Header buttons", eventAction: "click", - eventName: "interactive tutorial", + eventName: "How_to_use_wallet", }, variant: "outline", }, @@ -191,9 +191,9 @@ const WalletsPage = () => { href: "/wallets/find-wallet/", content: t("page-wallets-find-wallet-link"), matomo: { - eventCategory: "wallet hero buttons", + eventCategory: "Header button", eventAction: "click", - eventName: "find wallet", + eventName: "Find_wallet", }, }, ], @@ -253,11 +253,21 @@ const WalletsPage = () => { title: t("page-wallets-protecting-yourself"), description: "MyCrypto", link: "https://support.mycrypto.com/staying-safe/protecting-yourself-and-your-funds", + customEventOptions: { + eventCategory: "Link", + eventAction: "Clicked_external", + eventName: "protecting_yourself", + }, }, { title: t("page-wallets-keys-to-safety"), description: t("page-wallets-blog"), link: "https://www.coinbase.com/learn/crypto-basics/how-to-secure-crypto", + customEventOptions: { + eventCategory: "Link", + eventAction: "Clicked_external", + eventName: "the_keys_to_keeping_crypto_safe", + }, }, ] @@ -265,10 +275,20 @@ const WalletsPage = () => { { title: t("additional-reading-how-to-create-an-ethereum-account"), link: "/guides/how-to-create-an-ethereum-account/", + customEventOptions: { + eventCategory: "Link", + eventAction: "Clicked", + eventName: "Create_eth_acc", + }, }, { title: t("additional-reading-how-to-use-a-wallet"), link: "/guides/how-to-use-a-wallet/", + customEventOptions: { + eventCategory: "Link", + eventAction: "Clicked", + eventName: "How_to_use_wallet", + }, }, ] @@ -400,7 +420,14 @@ const WalletsPage = () => { > {t("page-wallets-features-desc")} - + {t("page-wallets-find-wallet-btn")}