From e486f7eeec0916ef16141bde4144496c90b6c196 Mon Sep 17 00:00:00 2001 From: Kris Haamer Date: Fri, 26 Apr 2024 13:15:24 +0800 Subject: [PATCH] Switch to Next-native Google Analytics --- app/layout.tsx | 14 +++++++------- package.json | 2 +- pnpm-lock.yaml | 36 ++++++++++++++++++++---------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index f8770df..5edc4e9 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,13 +1,13 @@ import type { Metadata } from "next"; import { GeistMono } from "geist/font/mono"; import { GeistSans } from "geist/font/sans"; -import { Analytics } from "@vercel/analytics/react"; +import { Analytics as NextAnalytics } from "@vercel/analytics/react"; import { Toaster } from "@/components/ui/toaster"; import { AI } from "./action"; import { Providers } from "@/components/providers"; -import { Hotjar } from "nextjs-hotjar"; +//import { Hotjar } from "nextjs-hotjar"; //import { init as initFullStory, FullStory } from "@fullstory/browser"; -import { GoogleAnalytics } from "nextjs-google-analytics"; +import { GoogleAnalytics } from "@next/third-parties/google"; import "./globals.css"; const meta = { @@ -61,7 +61,6 @@ export default function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - /* initFullStory({ orgId: "o-1XVGW4-na1" }); @@ -71,12 +70,12 @@ export default function RootLayout({ myprop: "somedata", }, }); + ; + */ return ( - - ; @@ -91,8 +90,9 @@ export default function RootLayout({ {children} - + + ); } diff --git a/package.json b/package.json index a9f0aa4..7f8ab18 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@fullstory/browser": "^2.0.4", + "@next/third-parties": "^14.2.3", "@pinecone-database/pinecone": "^2.2.0", "@polygon.io/client-js": "^7.3.2", "@radix-ui/colors": "^3.0.0", @@ -45,7 +46,6 @@ "next": "14.2.3", "next-auth": "5.0.0-beta.16", "next-themes": "^0.3.0", - "nextjs-google-analytics": "^2.3.3", "nextjs-hotjar": "^1.2.0", "openai": "^4.38.5", "react": "^18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae5f751..4eca083 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@fullstory/browser': specifier: ^2.0.4 version: 2.0.4 + '@next/third-parties': + specifier: ^14.2.3 + version: 14.2.3(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0) '@pinecone-database/pinecone': specifier: ^2.2.0 version: 2.2.0 @@ -110,9 +113,6 @@ importers: next-themes: specifier: ^0.3.0 version: 0.3.0(react-dom@18.3.0(react@18.3.0))(react@18.3.0) - nextjs-google-analytics: - specifier: ^2.3.3 - version: 2.3.3(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0) nextjs-hotjar: specifier: ^1.2.0 version: 1.2.0(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0) @@ -487,6 +487,12 @@ packages: cpu: [x64] os: [win32] + '@next/third-parties@14.2.3': + resolution: {integrity: sha512-j4E2xBSsEZq4VX2pVm3LpGltSwCxETic6glJWfHyYQvpoMdplCAYrQKpF+E9Gg3jfsrfmRAIdTE11m+biBCx1Q==} + peerDependencies: + next: ^13.0.0 || ^14.0.0 + react: ^18.2.0 + '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': resolution: {integrity: sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ==} @@ -2718,12 +2724,6 @@ packages: sass: optional: true - nextjs-google-analytics@2.3.3: - resolution: {integrity: sha512-Y6sI6A7wt5dji8hYBnVkOh9LTyImSLFZXx3FpyQgVW7W4b4qEFHjH2u3fhDJsrRZeLlUGM8/RuHD/mhHc2Axfg==} - peerDependencies: - next: '>=11.0.0' - react: '>=17.0.0' - nextjs-hotjar@1.2.0: resolution: {integrity: sha512-T0vBmModSXxAgv9e22T5aFbE1fhwuuAnq17ok+ZwnjnUePGL/p760Abag6NUhLLsJLE0wR7yASoRauFsi0AL0Q==} peerDependencies: @@ -3327,6 +3327,9 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + third-party-capital@1.0.20: + resolution: {integrity: sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA==} + to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -3866,6 +3869,12 @@ snapshots: '@next/swc-win32-x64-msvc@14.2.3': optional: true + '@next/third-parties@14.2.3(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0)': + dependencies: + next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0) + react: 18.3.0 + third-party-capital: 1.0.20 + '@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3': optional: true @@ -6567,13 +6576,6 @@ snapshots: - '@babel/core' - babel-plugin-macros - nextjs-google-analytics@2.3.3(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0): - dependencies: - next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0) - react: 18.3.0 - optionalDependencies: - fsevents: 2.3.3 - nextjs-hotjar@1.2.0(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0))(react@18.3.0): dependencies: next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)(sass@1.75.0) @@ -7269,6 +7271,8 @@ snapshots: dependencies: any-promise: 1.3.0 + third-party-capital@1.0.20: {} + to-fast-properties@2.0.0: {} to-regex-range@5.0.1: