fix: tweak CookiebotOnAccept effect hook

This commit is contained in:
Arvid Norlin
2024-03-07 18:56:11 +01:00
parent 5c465ca426
commit df94f47c27

View File

@@ -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