From 72758944689698c022a0bb03538be90e7ca8e7aa Mon Sep 17 00:00:00 2001 From: Brandon Tabaska Date: Mon, 13 May 2024 10:54:17 -0400 Subject: [PATCH 1/2] adding template --- frontend/src/app/template.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 frontend/src/app/template.tsx diff --git a/frontend/src/app/template.tsx b/frontend/src/app/template.tsx new file mode 100644 index 000000000..54a133d05 --- /dev/null +++ b/frontend/src/app/template.tsx @@ -0,0 +1,17 @@ +"use client"; + +import { useEffect } from "react"; +import { sendGAEvent } from "@next/third-parties/google"; +import { PUBLIC_ENV } from "../constants/environments"; + +export default function Template({ children }: { children: React.ReactNode }) { + const isProd = process.env.NODE_ENV === "development"; + + useEffect(() => { + isProd && + PUBLIC_ENV.GOOGLE_ANALYTICS_ID && + sendGAEvent({ event: "page_view" }); + }, [isProd]); + + return
{children}
; +} From 687c9740bad19fda571b60f08e2f6103af1e8234 Mon Sep 17 00:00:00 2001 From: Brandon Tabaska Date: Mon, 13 May 2024 10:55:17 -0400 Subject: [PATCH 2/2] adding template --- frontend/src/app/template.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/template.tsx b/frontend/src/app/template.tsx index 54a133d05..d0c3f4046 100644 --- a/frontend/src/app/template.tsx +++ b/frontend/src/app/template.tsx @@ -5,7 +5,7 @@ import { sendGAEvent } from "@next/third-parties/google"; import { PUBLIC_ENV } from "../constants/environments"; export default function Template({ children }: { children: React.ReactNode }) { - const isProd = process.env.NODE_ENV === "development"; + const isProd = process.env.NODE_ENV === "production"; useEffect(() => { isProd &&