I'm trying to implement a Cookiebot cookie consent banner in my React application, but I'm facing an issue where, after I decline some unnecessary cookies, the preferences are not being saved across page refreshes. Here's what I've tried and the behavior I’m encountering:
When I accept or decline cookies (necessary, preferences, statistics, marketing), the CookieConsent cookie is set correctly in the browser, and i see the unnecessary cookies being removed while inspecting the browser (Application Tab).
Ideally after accepting the cookie preferences, the preferences should persist even after a page refresh, but the cookie consent preferences are not respected, and upon refresh i see those cookies being added again.
I have tried the following three ways of implementing the cookiebot:
- Adding the Cookiebot Script in index.html
<script id="Cookiebot" src=".js"
data-cbid="<my-cbid>"
data-blockingmode="auto"
data-georegions="{'region':'US-06', 'cbid':'<my-cbid>'}">
</script>