Skip to content

Commit 29cfcbe

Browse files
authored
Add Vercel Analytics and Speed Insights integration (#468)
- Updated next.config.ts to include experimental features. - Added @vercel/analytics and @vercel/speed-insights dependencies in package.json. - Integrated SpeedInsights component in app/layout.tsx for performance tracking.
1 parent 5bab8fb commit 29cfcbe

File tree

4 files changed

+91
-2
lines changed

4 files changed

+91
-2
lines changed

app/layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Metadata } from 'next';
22
import { Geist } from 'next/font/google';
3+
import { SpeedInsights } from '@vercel/speed-insights/next';
34
import './globals.css';
45

56
const geistSans = Geist({
@@ -19,7 +20,10 @@ export default function RootLayout({
1920
}>) {
2021
return (
2122
<html lang="en">
22-
<body className={`${geistSans.variable} antialiased`}>{children}</body>
23+
<body className={`${geistSans.variable} antialiased`}>
24+
{children}
25+
<SpeedInsights />
26+
</body>
2327
</html>
2428
);
2529
}

next.config.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ import type { NextConfig } from "next";
22

33
const nextConfig: NextConfig = {
44
/* config options here */
5+
experimental: {
6+
// Enable experimental features if needed
7+
},
8+
// Ensure proper handling of Vercel Analytics and Speed Insights
9+
// headers: async () => {
10+
// return [
11+
// {
12+
// source: '/_vercel/speed-insights/script.js',
13+
// headers: [
14+
// {
15+
// key: 'Cache-Control',
16+
// value: 'public, max-age=31536000, immutable',
17+
// },
18+
// ],
19+
// },
20+
// ];
21+
// },
522
};
623

724
export default nextConfig;

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"@radix-ui/react-popover": "^1.1.13",
1212
"@radix-ui/react-slot": "^1.2.2",
1313
"@upstash/redis": "^1.34.9",
14+
"@vercel/analytics": "^1.5.0",
15+
"@vercel/speed-insights": "^1.2.0",
1416
"class-variance-authority": "^0.7.1",
1517
"clsx": "^2.1.1",
1618
"frimousse": "^0.2.0",
@@ -28,5 +30,6 @@
2830
"tailwindcss": "^4.1.6",
2931
"tw-animate-css": "^1.2.9",
3032
"typescript": "^5.8.3"
31-
}
33+
},
34+
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184"
3235
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)