File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/components/Glossary/GlossaryTooltip Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
import React , { ReactNode } from "react"
2
+ import { useRouter } from "next/router"
2
3
import { Box , Text } from "@chakra-ui/react"
3
4
4
5
import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
5
6
import Tooltip from "@/components/Tooltip"
6
7
8
+ import { trackCustomEvent } from "@/lib/utils/matomo"
9
+ import { cleanPath } from "@/lib/utils/url"
10
+
7
11
type GlossaryTooltipProps = {
8
12
children : ReactNode
9
13
termKey : string
10
14
}
11
15
12
16
const GlossaryTooltip = ( { children, termKey } : GlossaryTooltipProps ) => {
17
+ const { asPath } = useRouter ( )
18
+
13
19
return (
14
20
< Box display = "inline-block" >
15
21
< Tooltip
@@ -20,6 +26,13 @@ const GlossaryTooltip = ({ children, termKey }: GlossaryTooltipProps) => {
20
26
options = { { ns : "glossary-tooltip" } }
21
27
/>
22
28
}
29
+ onOpen = { ( ) => {
30
+ trackCustomEvent ( {
31
+ eventCategory : "Glossary Tooltip" ,
32
+ eventAction : cleanPath ( asPath ) ,
33
+ eventName : termKey ,
34
+ } )
35
+ } }
23
36
>
24
37
< Text
25
38
as = "u"
You can’t perform that action at this time.
0 commit comments