Skip to content

Commit

Permalink
add Google Tag Manager to app-root's layout (#6353)
Browse files Browse the repository at this point in the history
  • Loading branch information
goplayoutside3 authored Oct 3, 2024
1 parent 706a855 commit fef769f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/app-root/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"@next/bundle-analyzer": "~14.2.7",
"@next/third-parties": "~14.2.7",
"@zooniverse/async-states": "~0.0.1",
"@zooniverse/content": "~0.0.1",
"@zooniverse/grommet-theme": "~3.2.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/app-root/src/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import RootLayout from '@/components/RootLayout'
import StyledComponentsRegistry from './style-registry'
import { GoogleTagManager } from '@next/third-parties/google'

export const metadata = {
title: {
Expand All @@ -21,9 +22,12 @@ export const metadata = {
}
}

const isProduction = process.env.NODE_ENV === 'production'

export default function NextLayout({ children }) {
return (
<html lang='en'>
{isProduction && <GoogleTagManager gtmId='GTM-WDW6V4' />}
<StyledComponentsRegistry>
<RootLayout>{children}</RootLayout>
</StyledComponentsRegistry>
Expand Down

0 comments on commit fef769f

Please sign in to comment.