mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +00:00
wrap in GTM provider
This commit is contained in:
parent
2932d0822f
commit
c65e703e41
@ -2,6 +2,7 @@ import { Lato, Noto_Serif_JP } from 'next/font/google';
|
|||||||
import localFont from 'next/font/local';
|
import localFont from 'next/font/local';
|
||||||
import { ReactNode, Suspense } from 'react';
|
import { ReactNode, Suspense } from 'react';
|
||||||
|
|
||||||
|
import { GoogleProvider } from 'app/context/google-provider';
|
||||||
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
import { SupportedLocale } from 'components/layout/navbar/language-control';
|
||||||
import { NextIntlClientProvider } from 'next-intl';
|
import { NextIntlClientProvider } from 'next-intl';
|
||||||
import { notFound } from 'next/navigation';
|
import { notFound } from 'next/navigation';
|
||||||
@ -87,6 +88,8 @@ export default async function RootLayout({
|
|||||||
notFound();
|
notFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const shouldTrack = process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html
|
<html
|
||||||
lang={params.locale}
|
lang={params.locale}
|
||||||
@ -94,9 +97,11 @@ export default async function RootLayout({
|
|||||||
>
|
>
|
||||||
<body className="bg-dark text-white selection:bg-green-800 selection:text-green-400">
|
<body className="bg-dark text-white selection:bg-green-800 selection:text-green-400">
|
||||||
<NextIntlClientProvider locale={params?.locale} messages={messages}>
|
<NextIntlClientProvider locale={params?.locale} messages={messages}>
|
||||||
<Suspense>
|
<GoogleProvider isShowing={shouldTrack}>
|
||||||
<main>{children}</main>
|
<Suspense>
|
||||||
</Suspense>
|
<main>{children}</main>
|
||||||
|
</Suspense>
|
||||||
|
</GoogleProvider>
|
||||||
</NextIntlClientProvider>
|
</NextIntlClientProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
import { FunctionComponent, useEffect } from 'react';
|
import { FunctionComponent, useEffect } from 'react';
|
||||||
|
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/navigation';
|
||||||
import ReactGA from 'react-ga';
|
import ReactGA from 'react-ga';
|
||||||
import TagManager from 'react-gtm-module';
|
import TagManager from 'react-gtm-module';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user