最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

cookies - Cookiebot Consent Preferences Not Persisting After Page Refresh in React Application - Stack Overflow

programmeradmin3浏览0评论

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:

  1. 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>
发布评论

评论列表(0)

  1. 暂无评论