Skip to main content

Customization

How to Add a Multilingual Cookie Consent Banner?

If you have a website that has a multilingual target audience, then it is important that your cookie consent banner is also available in multiple languages. You can display a multilingual cookie consent banner with the CookieYes cookie consent solution.

To get started with CookieYes, create your account and try it for free.

After you sign up, you will be directed to a setup screen. During the setup, you will be able to select the Default Language of your cookie banner.

Your default language is the one in which your cookie banner will be displayed in when users have not set a language preference.

To implement a multilingual banner that is auto-translated as per your visitor’s preferred language, follow the steps below.

Cookie banner for multilingual websites

Step 1. From the top navigation panel of your CookieYes account, select Languages.

Languages tab

Step 2. You can see the default language you have selected. You can click on the +Add Language to add other languages you want your cookie banner to be displayed in.

+Add Language

Step 3. You can select all the languages you need and then click on Add.

Add new Language

Step 4. Once you’ve added the required languages, you will see them listed here. You can click on Edit Content to change/adapt the content of your cookie banner in that language.

 Edit Content

Step 5. On the new screen, you can see your Default Language on the left side and the language you want to Edit content in on the right side. You can then edit the content of the auto-translated text under Cookie Notice, Preference Center, Cookie List, Revisit Consent Button and Blocked Content.

language you want to Edit

Note

CookieYes features 31 languages with in-built auto-translated content. You can use the default translation provided or customize the content.

Step 6. You can then enable Banner Preview on top and you will be able to preview the banner on your website (as shown below).

Banner Preview

Step 7. When you have made all the required edits, you can click on Save & Publish to save these changes.

Advanced Configurations

The auto-translation works based on the lang attributes in the <html> tag. In case your website does not have a lang attribute, you can manually assign the language by following the steps below.

You can add the language inside the script tag, which will override both the default language and auto-detection. If you need the default language to be anything other than “en” (English), you can enter the desired 2-character language code instead.

<script>
        window.ckySettings = {
          documentLang: "en"
        };
</script>

This snippet should be added above the cookieyes script. 

 This feature is available only for users on the Basic, Pro and Ultimate plans.

Example: To display the French banner on https://example.com/fr and the English banner on https://example.com/ , the above snippet can be modified as follows:

<script>
    if (window.location.pathname.startsWith("/fr")) { 
        window.ckySettings = {
          documentLang: "fr"
       };
    } 
</script>

This will set the language as French for https://example.com/fr. For  https://example.com, the English banner is shown by default as per the customer’s choice. You can set the conditions as per requirement prior to setting the language.

You have now enabled a multilingual cookie banner for your website!

If you are facing any issues with this, please reach out to technical support.