Select your interface:
You are currently viewing instructions for the: Manager
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 value in the URL, for example:
- domain.com/nl (language in the pathname)
- nl.domain.com (language as a subdomain)
- domain.nl (Country defined in the domain extension)
First off, to make a language available, the language needs to be added to the Manager.
Under Settings, navigate to the Content tab, and add the desired language(s) by clicking on the green ✚ button.
You can then use the following snippet to insert the Cookiebot script with one of these languages determined by a value in the URL. The script replaces the Cookiebot scripts you would normally use.
If you are looking to add this feature to a Google Tag Manager setup, we recommend following this guide instead.
The script searches for language codes in the same order as they are listed above (1st: pathname, 2nd: subdomain, 3rd: extension). If no match is found, the default language is applied.
The script takes into account cases where the country code and the language codes don't match:
Country | Country code | Language code |
---|---|---|
Austria | AT | DE |
Australia | AU | EN |
Canada | CA | EN |
Czech Republic | CZ | CS |
Denmark | DK | DA |
Estonia | EE | ET |
Norway | NO | NB * |
Sweden | SE | SV |
United Kingdom | UK | EN |
You can enter your own data to update the snippet so you can directly copy and paste it in the header of your website.
Enter your own CBID here:
You can find your CBID in the Manager, on the "Your scripts" tab.
If you need the default language to be anything other than "en" (English) enter the desired 2 character language code here:
The Cookiebot script - manual cookie-blocking only:
<script>!function(C,oo,k,ie,b,o,t){
let a=C.scripts[0],c="en",d=C.createElement(ie),
e=[/^\/([a-z]{2})([_-][a-z]{2})?(\/.*)?/g.exec(k),/^([a-z]{2})\./.exec(oo),
/\.([a-z]{2,})$/.exec(oo)],f={at:"de",au:c,ca:c,cz:"cs",dk:"da",ee:"et",no:"nb",se:
"sv",uk:c},g=0;for(g of e){e=g?g[1]:t;if(g)break}e=e.length!=2?t:e;e=f[e]?f[e]:e;d.
id=b;d.src="https://consent.cookiebot.com/uc.js";d.dataset.cbid=o;d.dataset.
culture=e;d.async=!0;a.parentNode.insertBefore(d,a)}(document,location.hostname,
location.pathname,"script","Cookiebot","00000000-0000-0000-0000-000000000000","en")
</script>
The CookieDeclaration script:
<script>!function(de,cl,ar,at,i,o,n){
let a=de.createElement(at),b=[/^\/([a-z]{2})([_-][a-z]{2})?(\/.*)?$/g.exec(cl),
/^([a-z]{2})\./.exec(ar),/\.([a-z]{2,})$/.exec(ar)],c={at:"de",au:"en",ca:"en",cz:
"cs",dk:"da",ee:"et",no:"nb",se:"sv",uk:"en"},d=de.scripts,e=d[d.length-1],f=0;
for(f of b){b=f?f[1]:n;if(f)break}b=b.length!=2?o:b;b=c[b]?c[b]:b;a.id=i;a.dataset.
culture=b;a.src=`https://consent.cookiebot.com/${o}/cd.js`;e.parentNode.
insertBefore(a,e)}(document,location.pathname,location.hostname,"script",
"CookieDeclaration","00000000-0000-0000-0000-000000000000","en");</script>
* For Norwegian you can choose add both Bokmål (NB) which is the default, or Nynorsk (NN). If you prefer using Nynorsk instead of Bokmål, you'll need to make a small change to the scripts.
Specifically, you'll need to change no:"nb"
to no:"nn"
:
Comments
0 comments
Please sign in to leave a comment.