From c87829a86a90a8cfde5b82030801610fba83d776 Mon Sep 17 00:00:00 2001
From: Jerome Hardaway
Date: Sun, 17 Mar 2024 01:35:41 -0400
Subject: [PATCH] added initial tooling (#570)
* added initial tooling
* fix .gitignore
* fix the _document.tsx
---
.gitignore | 11 +++++++----
env.local | 1 +
env.production | 1 +
src/pages/_document.tsx | 19 ++++++++++++++++++-
yarn.lock | 6 +++---
5 files changed, 30 insertions(+), 8 deletions(-)
create mode 100644 env.local
create mode 100644 env.production
diff --git a/.gitignore b/.gitignore
index f526d55fd..81a513ae9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@ yarn-error.log*
# local env files
.env*.local
.env
+.env*.production
# vercel
.vercel
@@ -46,7 +47,9 @@ public/workbox-*.js
# Sitemap
/public/robots.txt
/public/sitemap.xml
-/public/sitemap-*.xml
-/test-results/
-/playwright-report/
-/playwright/.cache/
+/public/sitemap-*.xml
+/test-results/
+/playwright-report/
+/playwright/.cache/
+
+
diff --git a/env.local b/env.local
new file mode 100644
index 000000000..2bb5f4285
--- /dev/null
+++ b/env.local
@@ -0,0 +1 @@
+NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=G-WSXY307CRR
diff --git a/env.production b/env.production
new file mode 100644
index 000000000..2bb5f4285
--- /dev/null
+++ b/env.production
@@ -0,0 +1 @@
+NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=G-WSXY307CRR
diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx
index 3d68cc883..c26d143db 100644
--- a/src/pages/_document.tsx
+++ b/src/pages/_document.tsx
@@ -5,10 +5,27 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
export default class MyDocument extends Document {
render() {
const pageProps = this.props?.__NEXT_DATA__?.props?.pageProps;
+ const gaId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID; // Get the GA ID from environment variables
return (
-
+
+ {gaId && ( // Only include the script if the GA ID is present
+ <>
+ {/* Make self-closing */}
+ {/* Make self-closing */}
+ >
+ )}
+
diff --git a/yarn.lock b/yarn.lock
index 6f918cd6e..c4fa33f7e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1161,9 +1161,9 @@
dependencies:
"glob" "7.1.7"
-"@next/swc-darwin-x64@12.2.2":
- "integrity" "sha512-dztDtvfkhUqiqpXvrWVccfGhLe44yQ5tQ7B4tBfnsOR6vxzI9DNPHTlEOgRN9qDqTAcFyPxvg86mn4l8bB9Jcw=="
- "resolved" "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.2.2.tgz"
+"@next/swc-darwin-arm64@12.2.2":
+ "integrity" "sha512-JCoGySHKGt+YBk7xRTFGx1QjrnCcwYxIo3yGepcOq64MoiocTM3yllQWeOAJU2/k9MH0+B5E9WUSme4rOCBbpA=="
+ "resolved" "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.2.2.tgz"
"version" "12.2.2"
"@nodelib/fs.scandir@2.1.5":