Skip to content

Commit

Permalink
feat: support GTM
Browse files Browse the repository at this point in the history
  • Loading branch information
missionmike committed Oct 31, 2024
1 parent 0978557 commit 29e456a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ NEXT_PUBLIC_SANITY_API_VERSION="2023-08-01"
# on a non-local environment, you need to re-deploy the installation or force
# a Next.js revalidation.
SANITY_GRAPHQL_ENDPOINT="https://your/sanity/graphql/endpoint"

# Including Google Tag Manager for analytics, etc.? Add your GTM_ID here.
GTM_ID=
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@iconify/react": "^5.0.2",
"@mui/material": "^6.1.4",
"@mui/material-nextjs": "^6.1.4",
"@next/third-parties": "^15.0.2",
"@sanity/icons": "^3.4.0",
"@sanity/image-url": "^1.0.2",
"@sanity/vision": "^3.58.0",
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "./globals.scss";

import { AllThemeOptions, GET_THEME_OPTIONS } from "@/graphql/getThemeOptions";

import { GoogleTagManager } from "@next/third-parties/google";
import { Layout } from "@/components/Layout/Layout";
import type { Metadata } from "next";
import { ThemeAppearanceProvider } from "@/context/ThemeContext";
Expand Down Expand Up @@ -63,6 +64,7 @@ export default function RootLayout({
return (
<html lang="en">
<head>
{process.env?.GTM_ID ? <GoogleTagManager gtmId={process.env.GTM_ID} /> : null}
<meta name="viewport" content="initial-scale=1, width=device-width" />
</head>
<body className={`${geistSans.variable} ${geistMono.variable}`}>
Expand Down

0 comments on commit 29e456a

Please sign in to comment.