diff --git a/apps/docs/components/ButtonCard.tsx b/apps/docs/components/ButtonCard.tsx index f7df15298f3..a8e679f9b2c 100644 --- a/apps/docs/components/ButtonCard.tsx +++ b/apps/docs/components/ButtonCard.tsx @@ -1,6 +1,6 @@ -import React, { FC } from 'react' import Image from 'next/legacy/image' import Link from 'next/link' +import React, { FC } from 'react' import { cn } from 'ui' interface Props { @@ -11,6 +11,7 @@ interface Props { children?: any layout?: 'vertical' | 'horizontal' className?: string + onClick?: () => void } const ButtonCard: FC = ({ @@ -21,10 +22,12 @@ const ButtonCard: FC = ({ to, layout = 'vertical', className, + onClick, }) => { return ( > }) { + const pathname = usePathname() + const sendTelemetryEvent = useSendTelemetryEvent() + return ( diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.ts index 9d73133da48..f5a8280f32d 100644 --- a/packages/common/telemetry-constants.ts +++ b/packages/common/telemetry-constants.ts @@ -838,6 +838,26 @@ export interface AskAIEvent { } } +/** + * User clicked a recommended page card shown on a docs "not found" page. + * + * @group Events + * @source docs + */ +export interface DocsRecommendation404ClickedEvent { + action: 'docs_404_recommendation_clicked' + properties: { + /** + * The path of the recommended page that was clicked. + */ + destinationPath: string + /** + * The path of the "not found" page where the recommendation was shown. + */ + sourcePath: string + } +} + /** * User clicked the framework quickstart card on the homepage, leading to the specific framework documentation. * @@ -3460,6 +3480,7 @@ export type TelemetryEvent = | DocsFeedbackClickedEvent | CopyAsMarkdownEvent | AskAIEvent + | DocsRecommendation404ClickedEvent | HomepageFrameworkQuickstartClickedEvent | HomepageProductCardClickedEvent | WwwPricingPlanCtaClickedEvent