Skip to content

thgh/next-gtm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Tag Manager for Next.js 13 RSC

Install

yarn add @thgh/next-gtm

Add your GTM ID as an environment variable in .env or .env.local

NEXT_PUBLIC_GTM_ID=GTM-3X4MP7E

Add this snippet in app/layout.tsx

import { GoogleTagManagerBody, GoogleTagManagerHead } from '@thgh/next-gtm'

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html>
      <head>{GoogleTagManagerHead}</head>
      <body>
        {children}
        {GoogleTagManagerBody}
      </body>
    </html>
  )
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors