Skip to content

Commit 3c84ce3

Browse files
committed
implement matomo tracking updates
1 parent 47747e6 commit 3c84ce3

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/components/Buttons/Button.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "@chakra-ui/react"
77

88
import { scrollIntoView } from "../../utils/scrollIntoView"
9+
import { type MatomoEventOptions, trackCustomEvent } from "../../utils/matomo"
910

1011
export const checkIsSecondary = (props: {
1112
variant?: string
@@ -33,15 +34,15 @@ export interface IProps extends ButtonProps {
3334
* `NOTE`: Does not apply to the `Solid` or `Link` variants
3435
*/
3536
isSecondary?: boolean
37+
customEventOptions?: MatomoEventOptions
3638
}
3739

3840
const Button = forwardRef<IProps, "button">((props, ref) => {
39-
const { toId, onClick, isSecondary, ...rest } = props
41+
const { toId, onClick, isSecondary, customEventOptions, ...rest } = props
4042

4143
const handleOnClick = (e: React.MouseEvent<HTMLButtonElement>) => {
42-
if (toId) {
43-
scrollIntoView(toId)
44-
}
44+
toId && scrollIntoView(toId)
45+
customEventOptions && trackCustomEvent(customEventOptions)
4546

4647
onClick?.(e)
4748
}

src/components/FindWallet/WalletTable/index.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,13 @@ const WalletTable = ({ data, filters, walletData }: WalletTableProps) => {
427427
<Wallet
428428
onClick={() => {
429429
updateMoreInfo(wallet.key)
430-
trackCustomEvent({
431-
eventCategory: "WalletMoreInfo",
432-
eventAction: `More info wallet`,
433-
eventName: `More info ${wallet.name} ${wallet.moreInfo}`,
434-
})
430+
// Log "more info" event only on expanding
431+
wallet.moreInfo &&
432+
trackCustomEvent({
433+
eventCategory: "WalletMoreInfo",
434+
eventAction: `More info wallet`,
435+
eventName: `More info ${wallet.name}`,
436+
})
435437
}}
436438
>
437439
<Td lineHeight="revert">
@@ -473,7 +475,7 @@ const WalletTable = ({ data, filters, walletData }: WalletTableProps) => {
473475
customEventOptions={{
474476
eventCategory: "WalletExternalLinkList",
475477
eventAction: `Go to wallet`,
476-
eventName: `${wallet.name} ${idx}`,
478+
eventName: `Website: ${wallet.name} ${idx}`,
477479
eventValue: JSON.stringify(filters),
478480
}}
479481
>
@@ -486,7 +488,7 @@ const WalletTable = ({ data, filters, walletData }: WalletTableProps) => {
486488
customEventOptions={{
487489
eventCategory: "WalletExternalLinkList",
488490
eventAction: `Go to wallet`,
489-
eventName: `${wallet.name} ${idx}`,
491+
eventName: `Twitter: ${wallet.name} ${idx}`,
490492
eventValue: JSON.stringify(filters),
491493
}}
492494
>
@@ -504,7 +506,7 @@ const WalletTable = ({ data, filters, walletData }: WalletTableProps) => {
504506
customEventOptions={{
505507
eventCategory: "WalletExternalLinkList",
506508
eventAction: `Go to wallet`,
507-
eventName: `${wallet.name} ${idx}`,
509+
eventName: `Discord: ${wallet.name} ${idx}`,
508510
eventValue: JSON.stringify(filters),
509511
}}
510512
>

0 commit comments

Comments
 (0)