|
1 | 1 | import { Metadata } from 'next'
|
2 | 2 | import { Analytics } from '@vercel/analytics/react'
|
| 3 | +import Script from 'next/script' |
3 | 4 |
|
4 | 5 | import { Providers } from '@/app/providers'
|
5 | 6 |
|
@@ -28,35 +29,43 @@ export const metadata: Metadata = {
|
28 | 29 | },
|
29 | 30 | }
|
30 | 31 |
|
31 |
| -declare global { |
32 |
| - // eslint-disable-next-line @typescript-eslint/no-namespace |
33 |
| - namespace JSX { |
34 |
| - interface IntrinsicElements { |
35 |
| - 'chatlio-widget': any; |
36 |
| - } |
37 |
| - } |
38 |
| -} |
39 |
| - |
40 | 32 | export default async function RootLayout({ children }) {
|
41 | 33 | const pages = await glob('**/*.mdx', { cwd: 'src/app/(docs)/docs' })
|
42 | 34 | const allSectionsEntries = (await Promise.all(
|
43 |
| - pages.map(async filename => [ |
| 35 | + pages.map(async (filename) => [ |
44 | 36 | '/docs/' + filename.replace(/\(docs\)\/?|(^|\/)page\.mdx$/, ''),
|
45 | 37 | (await import(`./(docs)/docs/${filename}`)).sections,
|
46 |
| - ]), |
| 38 | + ]) |
47 | 39 | )) as Array<[string, Array<Section>]>
|
48 | 40 | const allSections = Object.fromEntries(allSectionsEntries)
|
49 | 41 |
|
50 | 42 | return (
|
51 |
| - <html |
52 |
| - lang="en" |
53 |
| - className="h-full" |
54 |
| - suppressHydrationWarning |
55 |
| - > |
| 43 | + <html lang="en" className="h-full" suppressHydrationWarning> |
56 | 44 | <head>
|
| 45 | + {process.env.NODE_ENV === 'production' && ( |
| 46 | + <Script id="google-tag-manager" strategy="afterInteractive"> |
| 47 | + {` |
| 48 | + (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': |
| 49 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], |
| 50 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= |
| 51 | + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); |
| 52 | + })(window,document,'script','dataLayer','GTM-K2W3LVD2'); |
| 53 | + `} |
| 54 | + </Script> |
| 55 | + )} |
57 | 56 | <Canonical />
|
58 | 57 | </head>
|
59 | 58 | <body className="flex min-h-full antialiased bg-zinc-900">
|
| 59 | + {process.env.NODE_ENV === 'production' && ( |
| 60 | + <noscript> |
| 61 | + <iframe |
| 62 | + src="https://www.googletagmanager.com/ns.html?id=GTM-K2W3LVD2" |
| 63 | + height="0" |
| 64 | + width="0" |
| 65 | + style={{ display: 'none', visibility: 'hidden' }} |
| 66 | + /> |
| 67 | + </noscript> |
| 68 | + )} |
60 | 69 | <Providers>
|
61 | 70 | <Layout allSections={allSections}>
|
62 | 71 | <Header />
|
|
0 commit comments