Skip to content

Commit 536d9e0

Browse files
authored
Merge pull request #13577 from rohitt-gupta/fix/-edit-page-button-event-tracking
add: event tracking on edit_page [Fixes: #13422]
2 parents a5a7728 + dab3099 commit 536d9e0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/TableOfContents/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ButtonLink } from "../ui/buttons/Button"
1212

1313
import { useActiveHash } from "@/hooks/useActiveHash"
1414
import { useTranslation } from "@/hooks/useTranslation"
15+
import { usePathname } from "@/i18n/routing"
1516

1617
export type TableOfContentsProps = {
1718
items: Array<ToCItem>
@@ -31,6 +32,7 @@ const TableOfContents = ({
3132
className,
3233
...rest
3334
}: TableOfContentsProps) => {
35+
const pathname = usePathname()
3436
const { t } = useTranslation("common")
3537

3638
const titleIds: Array<string> = []
@@ -66,7 +68,15 @@ const TableOfContents = ({
6668
{...rest}
6769
>
6870
{!hideEditButton && editPath && (
69-
<ButtonLink href={editPath} variant="outline">
71+
<ButtonLink
72+
href={editPath}
73+
variant="outline"
74+
customEventOptions={{
75+
eventCategory: "edit_page",
76+
eventAction: "gh_edit_click",
77+
eventName: `${pathname}`,
78+
}}
79+
>
7080
<Github />
7181
{t("edit-page")}
7282
</ButtonLink>

0 commit comments

Comments
 (0)