Skip to content

Commit 5053d9f

Browse files
authored
Merge pull request #13576 from rohitt-gupta/fix-event-tracking-wallet-page
fix event tracking: wallet page [Fixes #13420]
2 parents d930c0a + de419ec commit 5053d9f

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

src/components/CardList.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313

1414
import { BaseLink } from "@/components/Link"
1515

16+
import { MatomoEventOptions, trackCustomEvent } from "@/lib/utils/matomo"
1617
import * as url from "@/lib/utils/url"
1718

1819
import { useRtlFlip } from "@/hooks/useRtlFlip"
@@ -102,12 +103,14 @@ export type CardListProps = BoxProps & {
102103
items: CardProps[]
103104
imageWidth?: number
104105
clickHandler?: (idx: string | number) => void
106+
customEventOptions?: MatomoEventOptions
105107
}
106108

107109
const CardList = ({
108110
items,
109111
imageWidth,
110112
clickHandler = () => null,
113+
customEventOptions,
111114
...props
112115
}: CardListProps) => (
113116
<Box bg="background.base" w="full" {...props}>
@@ -122,7 +125,10 @@ const CardList = ({
122125
) : (
123126
<Card
124127
key={idx}
125-
onClick={() => clickHandler(idx)}
128+
onClick={() => {
129+
customEventOptions && trackCustomEvent(customEventOptions)
130+
clickHandler(idx)
131+
}}
126132
mb={4}
127133
{...listItem}
128134
/>

src/pages/wallets/index.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,18 @@ const WalletsPage = () => {
170170
href: "/wallets/find-wallet/",
171171
content: t("page-wallets-find-wallet-link"),
172172
matomo: {
173-
eventCategory: "wallet hero buttons",
173+
eventCategory: "Header buttons",
174174
eventAction: "click",
175-
eventName: "find wallet",
175+
eventName: "Find_wallet",
176176
},
177177
},
178178
{
179179
href: `#${SIMULATOR_ID}`,
180180
content: "How to use a wallet",
181181
matomo: {
182-
eventCategory: "wallet hero buttons",
182+
eventCategory: "Header buttons",
183183
eventAction: "click",
184-
eventName: "interactive tutorial",
184+
eventName: "How_to_use_wallet",
185185
},
186186
variant: "outline",
187187
},
@@ -191,9 +191,9 @@ const WalletsPage = () => {
191191
href: "/wallets/find-wallet/",
192192
content: t("page-wallets-find-wallet-link"),
193193
matomo: {
194-
eventCategory: "wallet hero buttons",
194+
eventCategory: "Header button",
195195
eventAction: "click",
196-
eventName: "find wallet",
196+
eventName: "Find_wallet",
197197
},
198198
},
199199
],
@@ -253,22 +253,42 @@ const WalletsPage = () => {
253253
title: t("page-wallets-protecting-yourself"),
254254
description: "MyCrypto",
255255
link: "https://support.mycrypto.com/staying-safe/protecting-yourself-and-your-funds",
256+
customEventOptions: {
257+
eventCategory: "Link",
258+
eventAction: "Clicked_external",
259+
eventName: "protecting_yourself",
260+
},
256261
},
257262
{
258263
title: t("page-wallets-keys-to-safety"),
259264
description: t("page-wallets-blog"),
260265
link: "https://www.coinbase.com/learn/crypto-basics/how-to-secure-crypto",
266+
customEventOptions: {
267+
eventCategory: "Link",
268+
eventAction: "Clicked_external",
269+
eventName: "the_keys_to_keeping_crypto_safe",
270+
},
261271
},
262272
]
263273

264274
const guides = [
265275
{
266276
title: t("additional-reading-how-to-create-an-ethereum-account"),
267277
link: "/guides/how-to-create-an-ethereum-account/",
278+
customEventOptions: {
279+
eventCategory: "Link",
280+
eventAction: "Clicked",
281+
eventName: "Create_eth_acc",
282+
},
268283
},
269284
{
270285
title: t("additional-reading-how-to-use-a-wallet"),
271286
link: "/guides/how-to-use-a-wallet/",
287+
customEventOptions: {
288+
eventCategory: "Link",
289+
eventAction: "Clicked",
290+
eventName: "How_to_use_wallet",
291+
},
272292
},
273293
]
274294

@@ -400,7 +420,14 @@ const WalletsPage = () => {
400420
>
401421
{t("page-wallets-features-desc")}
402422
</Box>
403-
<ButtonLink href="/wallets/find-wallet/">
423+
<ButtonLink
424+
href="/wallets/find-wallet/"
425+
customEventOptions={{
426+
eventCategory: "header buttons",
427+
eventAction: "click",
428+
eventName: "Find_wallet",
429+
}}
430+
>
404431
{t("page-wallets-find-wallet-btn")}
405432
</ButtonLink>
406433
<Image

0 commit comments

Comments
 (0)