Welcome to the Instapage Support Center

|

How can I translate the cookie bar message?

In case you need to translate the message and buttons present on our cookie bar, because your page experience is in a language other than English as well, you can use the code below to achieve this.

First, make sure you have the cookie bar enabled and set up according to this dedicated article here.

Then, copy this code and paste it under Settings > Javascript > Head:

<script>

document.addEventListener("DOMContentLoaded", function(){

    const newPageGenerator = window.__page_generator ? true : false;

    

    if (newPageGenerator){

        var cookieText = document.querySelector('.snackbar-content');

        var learnMoreLink = document.querySelector('.snackbar-link');

        var yesButton = document.querySelector('#ip-user-consent-accept');

        var noButton = document.querySelector('#ip-user-consent-decline');

    } else {

        var cookieText = document.querySelector('.t-cookie-bar__content p');

        var learnMoreLink = document.querySelector('.t-cookie-bar-link');

        var yesButton = document.querySelector('#ip-cookie-bar-accept');

        var noButton = document.querySelector('#ip-cookie-bar-decline');

    }

    

    // Replace text below

    cookieText.childNodes[0].nodeValue = "Enter your description here/Añada su descripción aquí. ";

    learnMoreLink.textContent = "Learn more/Aprende más";

    yesButton.textContent = "Yes, I accept/Sí, acepto";

    noButton.textContent = "I do not accept/No acepto";

})

</script>

You will need to change these parts to the message you want the visitor to see, according to your desired language:

cokiebar_copy.png

In case you need help with a custom functionality or any code customization that is not provided through our Help Center articles we have a Professional Services team that can help our Enterprise users. The Enterprise Solution includes Professional Services as well as additional features and services that can be seen here: https://instapage.com/enterprise-benefits

Have more questions? Submit a request
Was this article helpful?
2 out of 3 found this helpful

Need Further Help?

Tell us what you need and we will be happy to assist you.

Our team of expert support staff and our community can answer your questions. Submit a ticket, or reach out on live chat!