Set Cookie path

Comments

3 comments

  • Avatar
    Martin Iv. – vConnect

    Hey. 

    To separete cookie consent on language specific store views, you can use the following script (replace the Cookiebot script you would normally use), this will  "build" the Cookiebot script tag and add a data-culture attribute based on the value in the url.

    <script type="text/javascript">
    (function(c,oo,k,ie,b,o,t){
    var a=oo.getElementsByTagName(k)[0], d=oo.createElement(k), g=b.toLowerCase();
    d.id=c; d.src="https://consent.cookiebot.com/uc.js?cbid="+ie;d.setAttribute(o,t);
    if(null!=g.substring(0,4).match(/\/[a-z]{2}\//g)||null!=g.substring(0,4).match(/^\/[a-z]{2}$/g))h=g.substring(1,3),d.setAttribute("data-culture",h);
    a.parentNode.insertBefore(d,a);
    })('Cookiebot',document,'script','00000000-0000-0000-0000-000000000000',location.pathname,'data-blockingmode','auto');
    </script>

    Regards.






    0
    Comment actions Permalink
  • Avatar
    ec

    Hi,

    thank you so much for responding.

    This doesn't seem to work, I replaced the following cookiebot uc declaration with your code:

    <script id="Cookiebot" data-culture="EN" data-type="leveloptin" src="https://consent.cookiebot.com/uc.js" data-cbid="xxxx" data-blockingmode="auto" type="text/javascript"></script>

    This does get called, and location.pathname has the value of '/en' or '/de' or '/us' but once accepted on one site I am never asked again on one of the other language sites.

    0
    Comment actions Permalink
  • Avatar
    Martin Iv. – vConnect

    Hey,

    this should be activated bulk consent which activate the consent across the domains in the domain group, you can check it  from your manager in "Domain" tab , or you can renew consent by adding a button(link) with Cookiebot.renew(); like:
    <a onclick="javascript:Cookiebot.renew();">Renew consent</a> 
    so you deletes the CookieConsent cookie, Cookiebot will "forget" that the user has submitted consent, and the dialog will be shown again.

    Regards. 

    0
    Comment actions Permalink

Please sign in to leave a comment.