Cookiebot is able to detect the language setting of the end user's browser and adjust the language accordingly. And if you have sub domains, you can assign each to a domain group with their own (default) language.
But there are also situations where you want to determine the language the Cookiebot banner and the cookie declaration by a sub directory, for example: homepage.com/en or homepage.com/en/something, or by the domain extension, for example: homepage.nl.
First off, to make a language available, the language needs to be added in the Manager.
Under Settings, click the Content tab, and add the desired language(s) by clicking on the green "+" sign.
You can then use one of the following snippets to insert the Cookiebot script with the language predetermined. These scripts replace the Cookiebot scripts you would normally use.
You can enter your own CBID here to update the snippets, so that you can directly copy and past them in the header of your website
You can find your CBID in the Manager, on the "Your scripts" tab.
For automatic cookie-blocking:
<script>(function(c,oo,k,ie,b,o,t){
var a=oo.scripts[0],d=oo.createElement(k),
e=/^\/[a-z]{2}(-[a-z]{2}|\/)/g.test(b.pathname)?b.pathname.substring(1,3):
b.host.substring(b.host.lastIndexOf(".")+1,b.length),f=e.length>2?'en':e;
d.src='https://consent.cookiebot.com/uc.js',d.id=c;d.async=!1;
d.setAttribute('data-cbid',ie),d.setAttribute(o,t);e=='dk'?f='da':e=='no'?
f='nb':e=='se'?f='sv':e=='uk'?f='en':f;d.setAttribute('data-culture',f);
a.parentNode.insertBefore(d,a);})('Cookiebot',document,'script',
'00000000-0000-0000-0000-000000000000',location,'data-blockingmode','auto')</script>
For manual cookie-blocking:
<script>(function(c,y,b,o,t) {
var a=y.scripts[0],d=y.createElement(b),
e=/^\/[a-z]{2}(-[a-z]{2}|\/)/g.test(b.pathname)?b.pathname.substring(1,3):
t.host.substring(t.host.lastIndexOf(".")+1,t.length),f=e.length>2?'en':e;
d.src='https://consent.cookiebot.com/uc.js',d.setAttribute('data-cbid',o);
e=='dk'?f='da':e=='no'?f='nb':e=='se'?f='sv':e=='uk'?f='en':f;d.id=c;d.async=!0;
d.setAttribute('data-culture',f);a.parentNode.insertBefore(d,a)})('Cookiebot',
document,'script', '00000000-0000-0000-0000-000000000000',location)</script>
You can do something similar for the Cookie Declaration script:
<script>(function(de,cl,ar,at,io,n){
var a=io.createElement(de),
b=/^\/[a-z]{2}(-[a-z]{2}|\/)/g.test(b.pathname)?b.pathname.substring(1,3):
n.host.substring(n.host.lastIndexOf(".")+1,n.length),c=b.length>2?'en':b;
a.id=cl,a.async=!0,a.src='https://consent.cookiebot.com/'+ar+'/cd.js',a.type=at;
b=='dk'?c='da':b=='no'?c='nb':b=='se'?c='sv':c;a.setAttribute('data-culture',c);
io.currentScript.insertAdjacentElement('afterend',a);
})('script','CookieDeclaration', '00000000-0000-0000-0000-000000000000',
'text/javascript',document,location)</script>
Comments
0 comments
Please sign in to leave a comment.