@thgh/next-gtm
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

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>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @thgh/next-gtm

Weekly Downloads

27

Version

0.1.5

License

MIT

Unpacked Size

11.1 kB

Total Files

10

Last publish

Collaborators

  • thgh