From 09e12f746558d7690736bdd240859394ee8b7f50 Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:43:53 -0700 Subject: [PATCH] feat: add matomo event to glossary tooltip --- src/components/Glossary/GlossaryTooltip/index.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/Glossary/GlossaryTooltip/index.tsx b/src/components/Glossary/GlossaryTooltip/index.tsx index 75c48649fb9..708fa72bd2b 100644 --- a/src/components/Glossary/GlossaryTooltip/index.tsx +++ b/src/components/Glossary/GlossaryTooltip/index.tsx @@ -1,15 +1,21 @@ import React, { ReactNode } from "react" +import { useRouter } from "next/router" import { Box, Text } from "@chakra-ui/react" import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition" import Tooltip from "@/components/Tooltip" +import { trackCustomEvent } from "@/lib/utils/matomo" +import { cleanPath } from "@/lib/utils/url" + type GlossaryTooltipProps = { children: ReactNode termKey: string } const GlossaryTooltip = ({ children, termKey }: GlossaryTooltipProps) => { + const { asPath } = useRouter() + return ( { options={{ ns: "glossary-tooltip" }} /> } + onOpen={() => { + trackCustomEvent({ + eventCategory: "Glossary Tooltip", + eventAction: cleanPath(asPath), + eventName: termKey, + }) + }} >