Skip to content

Commit e3d3000

Browse files
committed
feat: add analytics script to layout for tracking web vitals and errors
1 parent 9d348c8 commit e3d3000

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/app/layout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "./global.css"
22
import { RootProvider } from "fumadocs-ui/provider"
33
import { Metadata } from "next"
44
import { Inter } from "next/font/google"
5+
import Script from "next/script"
56
import type { ReactNode } from "react"
67

78
const inter = Inter({
@@ -21,6 +22,13 @@ export default function Layout({ children }: { children: ReactNode }) {
2122
return (
2223
<html lang="en" className={inter.className} suppressHydrationWarning>
2324
<body className="flex flex-col min-h-screen">
25+
<Script
26+
src={process.env.NEXT_PUBLIC_ANALYTICS_URL}
27+
data-site-id={process.env.NEXT_PUBLIC_ANALYTICS_SITE_ID}
28+
data-web-vitals="true"
29+
data-track-errors="true"
30+
async
31+
/>
2432
<RootProvider>{children}</RootProvider>
2533
</body>
2634
</html>

0 commit comments

Comments
 (0)