From df94f47c27d48242e1e62df5698cd699fcafbbc9 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Thu, 7 Mar 2024 18:56:11 +0100 Subject: [PATCH] fix: tweak CookiebotOnAccept effect hook --- components/Current/Tracking.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/Current/Tracking.tsx b/components/Current/Tracking.tsx index 446663fb5..443e81490 100644 --- a/components/Current/Tracking.tsx +++ b/components/Current/Tracking.tsx @@ -79,10 +79,11 @@ export default function Tracking({ pageData }: TrackingProps) { window.addEventListener( "CookiebotOnAccept", function CookiebotCallback_OnAccept(e) { - setConsentCookie(window._satellite.cookie.get("CookieConsent")) + const cookie = window._satellite.cookie.get("CookieConsent") + setConsentCookie(cookie) if (window.Cookiebot?.changed && window.adobe) { - if (consentCookie?.includes("statistics:true")) { + if (cookie?.includes("statistics:true")) { window.adobe.optIn.approve( window.adobe.OptInCategories.ANALYTICS, true