Skip to content

Commit 94502cb

Browse files
Merge pull request #57 from databricks/thisistonydang/analytics
feat(analytics): add Vercel Analytics with copy-prompt event tracking
2 parents d9a34f3 + 72253bd commit 94502cb

5 files changed

Lines changed: 50 additions & 0 deletions

File tree

package-lock.json

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@hookform/resolvers": "^5.2.2",
3333
"@mdx-js/react": "^3.0.0",
3434
"@modelcontextprotocol/sdk": "^1.25.2",
35+
"@vercel/analytics": "^2.0.1",
3536
"@vercel/functions": "^3.4.3",
3637
"class-variance-authority": "^0.7.1",
3738
"clsx": "^2.0.0",

src/components/home/hero-section.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
22
import { useCallback, useRef, useState } from "react";
33
import { ArrowRight, Check, Clipboard, LoaderCircle } from "lucide-react";
44
import Link from "@docusaurus/Link";
5+
import { track } from "@vercel/analytics";
56
import { Button } from "@/components/ui/button";
67
import { getBootstrapPromptApiPath } from "@/lib/bootstrap-prompt";
78

@@ -76,6 +77,7 @@ export function HeroSection(): ReactNode {
7677
}
7778

7879
setCopyState("copied");
80+
track("copy_bootstrap_prompt", { source: "hero" });
7981
} catch {
8082
setCopyState("error");
8183
} finally {

src/components/home/wizard-flow.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Sparkles,
1111
type LucideIcon,
1212
} from "lucide-react";
13+
import { track } from "@vercel/analytics";
1314
import { Button } from "@/components/ui/button";
1415
import { getBootstrapPromptApiPath } from "@/lib/bootstrap-prompt";
1516

@@ -599,6 +600,7 @@ function CopyPromptButton(): ReactNode {
599600
}
600601

601602
setCopyState("copied");
603+
track("copy_bootstrap_prompt", { source: "wizard" });
602604
} catch {
603605
setCopyState("error");
604606
} finally {

src/theme/Root.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
22
import Head from "@docusaurus/Head";
33
import { useLocation } from "@docusaurus/router";
44
import BrowserOnly from "@docusaurus/BrowserOnly";
5+
import { Analytics } from "@vercel/analytics/react";
56
import { Toaster } from "sonner";
67

78
// Keep in sync with middleware.ts matcher and vercel.json headers/rewrites
@@ -46,6 +47,7 @@ function SonnerToaster() {
4647
export default function Root({ children }: { children: ReactNode }): ReactNode {
4748
return (
4849
<>
50+
<Analytics />
4951
<MarkdownAlternate />
5052
{children}
5153
<BrowserOnly>{() => <SonnerToaster />}</BrowserOnly>

0 commit comments

Comments
 (0)