diff --git a/.changeset/track-file-download-click.md b/.changeset/track-file-download-click.md new file mode 100644 index 000000000..1d8d7a263 --- /dev/null +++ b/.changeset/track-file-download-click.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Track Insights link clicks on the Download button of file blocks. diff --git a/packages/gitbook/src/components/primitives/DownloadButton.tsx b/packages/gitbook/src/components/primitives/DownloadButton.tsx index 205d0bcf6..e949659d5 100644 --- a/packages/gitbook/src/components/primitives/DownloadButton.tsx +++ b/packages/gitbook/src/components/primitives/DownloadButton.tsx @@ -1,4 +1,5 @@ 'use client'; +import { useTrackEvent } from '../Insights'; import { Button, type ButtonProps } from './Button'; /** @@ -7,13 +8,17 @@ import { Button, type ButtonProps } from './Button'; export function DownloadButton( props: Omit & { downloadUrl: string; filename: string } ) { - const { downloadUrl, filename, ...buttonProps } = props; + const { downloadUrl, filename, insights, ...buttonProps } = props; + const trackEvent = useTrackEvent(); return (