Fixing google analytics, adding some changes from prod

This commit is contained in:
Vladislav Khorev committed 2024-02-25 19:20:22 +00:00
1 parent 82eb226810
commit 3c4661a9c8
5 files changed
+456 -585

No files matched your search

+4 -12
View File
@@ -5,18 +5,8 @@ import "./App.scss";
import { Providers } from "./Providers";
import Navbar from "@/widgets/Navbar/Navbar";
import Footer from "@/widgets/Footer/Footer";
import { GoogleAnalytics } from '@next/third-parties/google'
const googleAnalyticsHtml = `
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-0BMJ2KN7F8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-0BMJ2KN7F8');
</script>
`
export default function RootLayout({
children,
@@ -25,7 +15,8 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<head dangerouslySetInnerHTML={{ __html: googleAnalyticsHtml }} />
<head>
</head>
<body>
<Providers>
<Navbar />
@@ -33,6 +24,7 @@ export default function RootLayout({
<Footer />
</Providers>
</body>
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS || ""} />
</html>
);
}