Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

✨ feat: add google analytics

Dillion Verma8bf13aaad8f0
diff --git a/app/layout.tsx b/app/layout.tsx
index 6deefa04..1184b8b7 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -1,3 +1,4 @@
+import { Analytics } from "@/components/analytics";
import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/toaster";
import { fontSans } from "@/lib/fonts";
@@ -30,7 +31,7 @@ export default function RootLayout({
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
{children}
<Toaster />
- {/* <Analytics /> */}
+ <Analytics />
{/* <TailwindIndicator /> */}
</ThemeProvider>
</body>
diff --git a/components/analytics.tsx b/components/analytics.tsx
new file mode 100644
index 00000000..3afb16d0
--- /dev/null
+++ b/components/analytics.tsx
@@ -0,0 +1,23 @@
+"use client";
+
+import Script from "next/script";
+
+export function Analytics() {
+ return (
+ <>
+ <Script
+ async
+ src="https://www.googletagmanager.com/gtag/js?id=G-4CVHZX68BT"
+ ></Script>
+ <Script id="gtag">
+ {`
+window.dataLayer = window.dataLayer || [];
+function gtag(){dataLayer.push(arguments);}
+gtag('js', new Date());
+
+gtag('config', 'G-4CVHZX68BT');
+`}
+ </Script>
+ </>
+ );
+}