Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import GlobalHeader from '@/components/GlobalHeader/GlobalHeader';
import { SnowOverlayProvider } from '@/providers/SnowOverlayProvider';
import SnowOverlayWrapper from '@/components/SnowOverlayWrapper/SnowOverlayWrapper';
import AuthContextProvider from '@/context/AuthContextProvider';
import Script from 'next/script';

const geistSans = localFont({
src: './fonts/GeistVF.woff',
Expand Down Expand Up @@ -38,6 +39,20 @@ const RootLayout = ({
}>): JSX.Element => {
return (
<html lang="en">
<head>
<Script
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID}`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

G-D4KQR9DSXY

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

strategy="afterInteractive"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference to anyone new to strategy="afterInteractive". Essentially this is Next.js setting the script as async for you.

/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID}');
`}
</Script>
</head>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased bg-gradient`}
>
Expand Down