mirror of
https://github.com/XFox111/my-website.git
synced 2026-04-22 07:28:01 +03:00
fix: cookie consent tracking breaks when CDN caching is involved
This commit is contained in:
+6
-4
@@ -5,7 +5,7 @@ import { PropsWithChildren } from "react";
|
||||
import CookieBanner from "./_components/CookieBanner";
|
||||
import Footer from "./_components/Footer";
|
||||
import Header from "./_components/Header";
|
||||
import { canLoadAnalytics, requireExcplicitConsent } from "./_utils/analytics/server";
|
||||
import { analyticsEnabled, requireExplicitConsent } from "./_utils/analytics/server";
|
||||
import fonts from "./fonts";
|
||||
import "./globals.scss";
|
||||
|
||||
@@ -23,12 +23,14 @@ export default function RootLayout(props: PropsWithChildren)
|
||||
{
|
||||
return (
|
||||
<html lang="en" className={ fonts.map(i => i.variable).join(" ") }>
|
||||
{ canLoadAnalytics() &&
|
||||
// If "Do Not Track" is enabled, or there's no CLARITY_ID set up, we don't load any analytics
|
||||
{ analyticsEnabled() &&
|
||||
<Script id="ms-clarity" src="/clarity.js" data-id={ process.env.CLARITY_ID } />
|
||||
}
|
||||
<body>
|
||||
{ canLoadAnalytics() && <CookieBanner askForConsent={ requireExcplicitConsent() } /> }
|
||||
{ analyticsEnabled() &&
|
||||
<CookieBanner askForConsent={ requireExplicitConsent() } />
|
||||
}
|
||||
|
||||
<Header />
|
||||
{ props.children }
|
||||
<Footer />
|
||||
|
||||
Reference in New Issue
Block a user