From 2870ae7ffc2310afd7e907728978cd811c0ce4c8 Mon Sep 17 00:00:00 2001
From: Fatih Cetinkaya <965295+devfacet@users.noreply.github.com>
Date: Thu, 29 Feb 2024 16:26:03 -0500
Subject: [PATCH] Add analytics (#2)
---
app/layout.tsx | 7 +++++++
package-lock.json | 21 +++++++++++++++++++++
package.json | 1 +
3 files changed, 29 insertions(+)
diff --git a/app/layout.tsx b/app/layout.tsx
index e117ec9..6b93391 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -3,8 +3,12 @@
import type { Metadata } from 'next'
import { Providers } from '@/app/providers'
import { Toaster } from 'react-hot-toast'
+import { Analytics as VercelAnalytics } from '@vercel/analytics/react'
import '@/app/globals.css'
+// Init vars
+const vercelAnalyticsEnabled = process.env.VERCEL_ANALYTICS_ENABLED || false
+
export const metadata: Metadata = {
title: 'Duel of the Paddles',
description: 'Yet another pong game',
@@ -35,6 +39,9 @@ export default function RootLayout({ children }: Readonly<{children: React.React
{children}
+ {vercelAnalyticsEnabled &&
+
+ }