Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #1918]: Add GA4 id to Dev #1927

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ export default function RootLayout({ children }: LayoutProps) {
{/* TODO: Add locale="english" prop when ready for i18n */}
<Layout>{children}</Layout>
</body>
{process.env.NEXT_PUBLIC_ENVIRONMENT === "prod" && (
<GoogleAnalytics gaId={PUBLIC_ENV.GOOGLE_ANALYTICS_ID} />
)}
<GoogleAnalytics gaId={PUBLIC_ENV.GOOGLE_ANALYTICS_ID} />
</html>
);
}
5 changes: 1 addition & 4 deletions frontend/src/constants/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
*/
const PUBLIC_ENV_VARS_BY_ENV = {
development: {
GOOGLE_TAG_MANAGER_ID: "GTM-MV57HMHS",
GOOGLE_ANALYTICS_ID: "G-6MDCC5EZW2",
GOOGLE_ANALYTICS_ID: "G-GWJZD3DL8W",
},
test: {
GOOGLE_TAG_MANAGER_ID: "GTM-MV57HMHS",
GOOGLE_ANALYTICS_ID: "G-6MDCC5EZW2",
},
production: {
GOOGLE_TAG_MANAGER_ID: "GTM-MV57HMHS",
GOOGLE_ANALYTICS_ID: "G-6MDCC5EZW2",
},
} as const;
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "../styles/styles.scss";

import type { AppProps } from "next/app";
import { GoogleTagManager } from "@next/third-parties/google";
import { GoogleAnalytics } from "@next/third-parties/google";
import Head from "next/head";
import Layout from "../components/Layout";
import { PUBLIC_ENV } from "src/constants/environments";
Expand All @@ -19,9 +19,7 @@ function MyApp({ Component, pageProps }: AppProps) {
</Head>
<Layout>
<Component {...pageProps} />
{process.env.NEXT_PUBLIC_ENVIRONMENT === "prod" && (
<GoogleTagManager gtmId={PUBLIC_ENV.GOOGLE_TAG_MANAGER_ID} />
)}
<GoogleAnalytics gaId={PUBLIC_ENV.GOOGLE_ANALYTICS_ID} />
</Layout>
</>
);
Expand Down
Loading