Skip to content

Commit

Permalink
Merge pull request #13576 from rohitt-gupta/fix-event-tracking-wallet…
Browse files Browse the repository at this point in the history
…-page

fix event tracking: wallet page [Fixes #13420]
  • Loading branch information
corwintines authored Aug 27, 2024
2 parents d930c0a + de419ec commit 5053d9f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/components/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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) => (
<Box bg="background.base" w="full" {...props}>
Expand All @@ -122,7 +125,10 @@ const CardList = ({
) : (
<Card
key={idx}
onClick={() => clickHandler(idx)}
onClick={() => {
customEventOptions && trackCustomEvent(customEventOptions)
clickHandler(idx)
}}
mb={4}
{...listItem}
/>
Expand Down
41 changes: 34 additions & 7 deletions src/pages/wallets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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",
},
},
],
Expand Down Expand Up @@ -253,22 +253,42 @@ 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",
},
},
]

const guides = [
{
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",
},
},
]

Expand Down Expand Up @@ -400,7 +420,14 @@ const WalletsPage = () => {
>
{t("page-wallets-features-desc")}
</Box>
<ButtonLink href="/wallets/find-wallet/">
<ButtonLink
href="/wallets/find-wallet/"
customEventOptions={{
eventCategory: "header buttons",
eventAction: "click",
eventName: "Find_wallet",
}}
>
{t("page-wallets-find-wallet-btn")}
</ButtonLink>
<Image
Expand Down

0 comments on commit 5053d9f

Please sign in to comment.