debug: re-enable CookiebotOnAccept logic within JSX
This commit is contained in:
@@ -74,41 +74,40 @@ export default function Tracking({ pageData }: TrackingProps) {
|
||||
}
|
||||
}, [pathName, queryString, pageData])
|
||||
|
||||
// useEffect(() => {
|
||||
// // handle consent
|
||||
// console.log("in effect")
|
||||
// window.addEventListener(
|
||||
// "CookiebotOnAccept",
|
||||
// function CookiebotCallback_OnAccept(e) {
|
||||
// console.log("Cookiebot onAccept callback fired ✅")
|
||||
// setConsentCookie(window._satellite.cookie.get("CookieConsent"))
|
||||
// if (window.Cookiebot?.changed && window.adobe) {
|
||||
// if (consentCookie?.includes("statistics:true")) {
|
||||
// window.adobe.optIn.approve(
|
||||
// window.adobe.OptInCategories.ANALYTICS,
|
||||
// true
|
||||
// )
|
||||
// } else {
|
||||
// window.adobe.optIn.deny(
|
||||
// window.adobe.OptInCategories.ANALYTICS,
|
||||
// true
|
||||
// )
|
||||
// }
|
||||
// window.adobe.optIn.complete()
|
||||
// window.dispatchEvent(new Event("load"))
|
||||
// console.log("dispatched load event")
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// window.addEventListener(
|
||||
// "CookiebotOnDecline",
|
||||
// function CookebotCallback_OnDecline() {
|
||||
// if (window.Cookiebot?.changed && window.adobe) {
|
||||
// window.adobe.optIn.deny(window.adobe.OptInCategories.ANALYTICS, true)
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }, [consentCookie])
|
||||
useEffect(() => {
|
||||
// handle consent
|
||||
window.addEventListener(
|
||||
"CookiebotOnAccept",
|
||||
function CookiebotCallback_OnAccept(e) {
|
||||
setConsentCookie(window._satellite.cookie.get("CookieConsent"))
|
||||
|
||||
if (window.Cookiebot?.changed && window.adobe) {
|
||||
if (consentCookie?.includes("statistics:true")) {
|
||||
window.adobe.optIn.approve(
|
||||
window.adobe.OptInCategories.ANALYTICS,
|
||||
true
|
||||
)
|
||||
} else {
|
||||
window.adobe.optIn.deny(
|
||||
window.adobe.OptInCategories.ANALYTICS,
|
||||
true
|
||||
)
|
||||
}
|
||||
window.adobe.optIn.complete()
|
||||
window.dispatchEvent(new Event("load"))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
window.addEventListener(
|
||||
"CookiebotOnDecline",
|
||||
function CookebotCallback_OnDecline() {
|
||||
if (window.Cookiebot?.changed && window.adobe) {
|
||||
window.adobe.optIn.deny(window.adobe.OptInCategories.ANALYTICS, true)
|
||||
}
|
||||
}
|
||||
)
|
||||
}, [consentCookie])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user