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 + <> +