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 && + + } diff --git a/package-lock.json b/package-lock.json index f9f3d39..459ca28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@nextui-org/react": "^2.2.9", + "@vercel/analytics": "^1.2.2", "framer-motion": "^11.0.3", "next": "14.1.0", "next-themes": "^0.2.1", @@ -3076,6 +3077,26 @@ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", "dev": true }, + "node_modules/@vercel/analytics": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@vercel/analytics/-/analytics-1.2.2.tgz", + "integrity": "sha512-X0rctVWkQV1e5Y300ehVNqpOfSOufo7ieA5PIdna8yX/U7Vjz0GFsGf4qvAhxV02uQ2CVt7GYcrFfddXXK2Y4A==", + "dependencies": { + "server-only": "^0.0.1" + }, + "peerDependencies": { + "next": ">= 13", + "react": "^18 || ^19" + }, + "peerDependenciesMeta": { + "next": { + "optional": true + }, + "react": { + "optional": true + } + } + }, "node_modules/acorn": { "version": "8.11.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", diff --git a/package.json b/package.json index 833c475..7d75ab2 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "homepage": "https://github.com/devfacet/dotp", "dependencies": { "@nextui-org/react": "^2.2.9", + "@vercel/analytics": "^1.2.2", "framer-motion": "^11.0.3", "next": "14.1.0", "next-themes": "^0.2.1",