From 7db32ce6361eb076eefbd621d8ae3788c806d336 Mon Sep 17 00:00:00 2001 From: Wade Hammes Date: Sat, 21 Dec 2024 13:38:54 -0500 Subject: [PATCH] Chore: add Google Analytics --- next.config.js | 4 ++++ package.json | 1 + pnpm-lock.yaml | 20 ++++++++++++++++++++ src/app/layout.tsx | 8 +++----- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/next.config.js b/next.config.js index adc6346..db3e161 100644 --- a/next.config.js +++ b/next.config.js @@ -8,6 +8,10 @@ module.exports = { styledComponents: true, reactRemoveProperties: false, }, + env: { + ENVIRONMENT: process.env.ENVIRONMENT, + GOOGLE_ANALYTICS_KEY: process.env.GOOGLE_ANALYTICS_KEY, + }, webpack(config) { config.plugins.push(new StylelintPlugin()); diff --git a/package.json b/package.json index eae7dd1..03f12fe 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "dependencies": { "@emotion/is-prop-valid": "^1.3.1", "@jest/types": "^29.6.3", + "@next/third-parties": "^15.1.2", "@svgr/webpack": "^8.1.0", "@testing-library/react": "^16.1.0", "classnames": "^2.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4d9aa3d..80f97fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@jest/types': specifier: ^29.6.3 version: 29.6.3 + '@next/third-parties': + specifier: ^15.1.2 + version: 15.1.2(next@15.1.2(@babel/core@7.23.6)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) '@svgr/webpack': specifier: ^8.1.0 version: 8.1.0(typescript@5.7.2) @@ -1293,6 +1296,12 @@ packages: cpu: [x64] os: [win32] + '@next/third-parties@15.1.2': + resolution: {integrity: sha512-orv0nicbRg+opfOVyQSn45AJoTFSLycYJSljHvqaUd2i5KAFzMcxjrxBjtjNGB9PRdLcIyqZCiDGeK+a34nNOw==} + peerDependencies: + next: ^13.0.0 || ^14.0.0 || ^15.0.0 + react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0 + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -3303,6 +3312,9 @@ packages: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} + third-party-capital@1.0.20: + resolution: {integrity: sha512-oB7yIimd8SuGptespDAZnNkzIz+NWaJCu2RMsbs4Wmp9zSDUM8Nhi3s2OOcqYuv3mN4hitXc8DVx+LyUmbUDiA==} + tmpl@1.0.5: resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} @@ -4944,6 +4956,12 @@ snapshots: '@next/swc-win32-x64-msvc@15.1.2': optional: true + '@next/third-parties@15.1.2(next@15.1.2(@babel/core@7.23.6)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0)': + dependencies: + next: 15.1.2(@babel/core@7.23.6)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + react: 19.0.0 + third-party-capital: 1.0.20 + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -7208,6 +7226,8 @@ snapshots: glob: 7.2.3 minimatch: 3.1.2 + third-party-capital@1.0.20: {} + tmpl@1.0.5: {} to-fast-properties@2.0.0: {} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2aba1cf..05cabf9 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,6 +1,7 @@ "use client"; import isValidProp from "@emotion/is-prop-valid"; +import { GoogleAnalytics } from "@next/third-parties/google"; import { Space_Mono } from "next/font/google"; import StyledComponentsRegistry from "src/lib/registry"; import { CSSRootVariables } from "src/styles/cssVariables"; @@ -22,11 +23,7 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( - + @@ -35,6 +32,7 @@ export default function RootLayout({ {children} + );