Next.js Discord

Discord Forum

Google tag manager

Unanswered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
How can i implement google tag manager / g4a in nextjs 14 app router?

3 Replies

you can implement it via the third-partys from nextjs. Take a look at this example:

import { GoogleTagManager } from '@next/third-parties/google'
 
export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <body>{children}</body>
      <GoogleTagManager gtmId="GTM-XYZ" />
    </html>
  )
}


First install @next/third-parties @Tonkinese
@Tonkinese solved?
@Tonkinese ?