Cookiebot multilingual support in combination with Google Tag Manager

When you operate a multilingual website and would like to have the cookie banner displayed in the same language as your website (E.g. English for “” and Spanish for “”) you can use the data-culture attribute.

While this can be achieved in multiple ways, you may for example create a Custom JavaScript Variable named “Current Language” that returns a two-letter ISO language code based on custom logic. In this example, the language is set to either French or Spanish and will default to English, depending on the path of the URL that the user is currently visiting on your website:


var CookieConsentScriptContainer = document.getElementsByTagName('script')[0];

var CookieConsentScript = document.createElement("script");

CookieConsentScript.type = "text/javascript"; = "CookieConsent";

CookieConsentScript.src = "";

var currentUserPagePathname = location.pathname.toLowerCase();
var currentUserPageCulture = "en";  //default to english

if (currentUserPagePathname.indexOf("/fr")==0)
currentUserPageCulture = "fr";
else if (currentUserPagePathname.indexOf("/es")==0)
currentUserPageCulture = "es";

CookieConsentScript.setAttribute("data-culture", currentUserPageCulture);
CookieConsentScriptContainer.parentNode.insertBefore(CookieConsentScript, CookieConsentScriptContainer);

function CookieConsentCallback_OnAccept() {
if (CookieConsent.consent.preferences)
if (CookieConsent.consent.statistics)
if (

Don’t forget to replace cbid=00000000-0000-0000-0000-000000000000 with your own code.