Skip to content

Commit 86e5952

Browse files
committed
Add Google Analytics tag to the global layout
1 parent a6684b5 commit 86e5952

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎web/app/layout.js‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './globals.css';
2+
import Script from 'next/script';
23
import { assetPath } from '../lib/site-path';
34
export const metadata = {
45
title: 'UFFeScience Research Group — Projects and research',
@@ -9,7 +10,21 @@ export const metadata = {
910
export default function RootLayout({ children }) {
1011
return (
1112
<html lang="en">
12-
<body>{children}</body>
13+
<body>
14+
{children}
15+
<Script
16+
src="https://www.googletagmanager.com/gtag/js?id=G-T2J14TCC5C"
17+
strategy="afterInteractive"
18+
/>
19+
<Script id="google-analytics" strategy="afterInteractive">
20+
{`
21+
window.dataLayer = window.dataLayer || [];
22+
function gtag() { window.dataLayer.push(arguments); }
23+
gtag('js', new Date());
24+
gtag('config', 'G-T2J14TCC5C');
25+
`}
26+
</Script>
27+
</body>
1328
</html>
1429
);
1530
}

0 commit comments

Comments
 (0)