Skip to content

Commit ecd55ba

Browse files
committed
fix(analytics): load landing GTM container on docs (cookie banner + Ads)
Docs loaded GA4 G-S8X2QYX44Z directly via gtag, so /docs pages had no cookie consent banner, no Google Ads tag, and sent hits to a separate GA4 property. Load the landing's GTM-WW7L89N container instead, which carries the banner, GA4 G-LF4NC4LKWN with Consent Mode, and the Ads conversion tag.
1 parent 41f520a commit ecd55ba

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
'use client'
22

33
import { useEffect, useState } from 'react'
4-
import { GoogleAnalytics } from '@next/third-parties/google'
4+
import { GoogleTagManager } from '@next/third-parties/google'
55

6-
// Loads Google Analytics only on the production host, so localhost and the
7-
// *.faable.link preview/origin deploys don't pollute production analytics.
8-
export function ProdGoogleAnalytics({ gaId }) {
6+
// Loads the same GTM container as the landing (cookie banner, GA4
7+
// G-LF4NC4LKWN with Consent Mode, and the Google Ads tag) only on the
8+
// production host, so localhost and the *.faable.link preview/origin
9+
// deploys don't pollute production analytics.
10+
export function ProdGoogleTagManager({ gtmId }) {
911
const [enabled, setEnabled] = useState(false)
1012

1113
useEffect(() => {
@@ -19,5 +21,5 @@ export function ProdGoogleAnalytics({ gaId }) {
1921
}
2022
}, [])
2123

22-
return enabled ? <GoogleAnalytics gaId={gaId} /> : null
24+
return enabled ? <GoogleTagManager gtmId={gtmId} /> : null
2325
}

‎app/layout.jsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '../globals.css'
2-
import { ProdGoogleAnalytics } from './components/ProdGoogleAnalytics'
2+
import { ProdGoogleTagManager } from './components/ProdGoogleTagManager'
33

44
export const metadata = {
55
metadataBase: new URL('https://faable.com'),
@@ -87,7 +87,10 @@ export default function RootLayout({ children }) {
8787
>
8888
<body>
8989
{children}
90-
<ProdGoogleAnalytics gaId="G-S8X2QYX44Z" />
90+
{/* Same container as the landing: cookie banner + GA4 G-LF4NC4LKWN
91+
(Consent Mode) + Google Ads tag, so /docs campaign traffic gets
92+
consent and conversion tracking. */}
93+
<ProdGoogleTagManager gtmId="GTM-WW7L89N" />
9194
</body>
9295
</html>
9396
)

0 commit comments

Comments
 (0)