1
0
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:
2024-10-24 16:20:34 +00:00
parent 5a4b67d83e
commit f2e985cfea
5 changed files with 25 additions and 21 deletions
+4 -1
View File
@@ -12,11 +12,14 @@ const CookieBanner: React.FC<{ askForConsent: boolean; }> = props =>
useEffect(() =>
{
if (navigator.doNotTrack === "1")
return;
const choice = getCookieChoice();
setVisible(choice === "none");
// Since Clarity cookies expiration dates extend well beyond 60 days,
// we need to terminate them manually once our consent tracking cookie expires.
// we need to terminate them manually once our consent tracking cookie expired.
if (choice !== "accepted")
window.clarity?.("consent", false);
}, []);