From 8dd9444596e3b78d284402cf41aed72a2282bbd3 Mon Sep 17 00:00:00 2001 From: "Nolann B." <100787331+nolannbiron@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:16:06 +0200 Subject: [PATCH] Track Insights link clicks on the file block Download button (#4632) --- .changeset/track-file-download-click.md | 5 +++++ .../gitbook/src/components/primitives/DownloadButton.tsx | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/track-file-download-click.md 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 (