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 = "Añada su descripción aquí. ";

    learnMoreLink.textContent = "Aprende más";

    yesButton.textContent = "Sí, acepto";

    noButton.textContent = "No acepto";

})

</script>

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

cookiebartext1_copy.png

Have more questions? Submit a request
Was this article helpful?
0 out of 1 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!