docs: track code copy + AI assistant event (#14193)

* docs: track code copy + AI assistant event

* add pathname to callback
This commit is contained in:
Shahed Nasser
2025-12-02 17:24:31 +02:00
committed by GitHub
parent ef162f8b5f
commit 00052b9e50
12 changed files with 75 additions and 64 deletions
@@ -1,24 +1,17 @@
"use client"
import {
DocsTrackingEvents,
Feedback as UiFeedback,
FeedbackProps as UiFeedbackProps,
} from "docs-ui"
import { usePathname } from "next/navigation"
import { useMemo } from "react"
import { basePathUrl } from "../../utils/base-path-url"
type FeedbackProps = Omit<UiFeedbackProps, "event" | "pathName">
export const Feedback = (props: FeedbackProps) => {
const pathname = usePathname()
const feedbackPathname = useMemo(() => basePathUrl(pathname), [pathname])
return (
<UiFeedback
event="survey"
pathName={feedbackPathname}
event={DocsTrackingEvents.SURVEY}
question="Was this page helpful?"
{...props}
/>