Как добавить согласие на использование файлов cookie в Wix?

Adding a cookie consent to Wix is easy and only takes a few minutes. You can add a cookie consent to your site in the Wix Editor by going to the “Settings” tab and selecting “Cookie Consent.”

From there, you can choose to either accept all cookies or only certain types of cookies. You can also customize the message that appears in the cookie consent pop-up.

If you’re not using the Wix Editor, you can still add a cookie consent to your site. To do so, you’ll need to use Wix Code. First, create a new page and add the following code to it:

function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = «expires=»+d. toUTCString(); document.cookie = cname + «=» + cvalue + «;» + expires + «;path=/»; } function getCookie(cname) { var name = cname + «=»; var ca = document. cookie.split(«;»); for(var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == " ") { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } if (getCookie("cookieConsent") != "true") { // Show cookie consent popup only once document.write("

This website uses cookies to improve your experience. OK

«);

PRO TIP: Adding a cookie consent to Wix is easy, but there are a few things to keep in mind. First, make sure you have a good understanding of what cookies are and why you need to get consent for them. Second, be aware that there are different types of cookie consent, so make sure you choose the right one for your website. Finally, remember to test your cookie consent before you launch it on your site.

document.getElementById(«cookieConsentOK»). onclick = function() {

setCookie(«cookieConsent», «true», 30); // Set cookie to expire in 30 days

document.getElementById(«cookieConsent»).style.display = «none»; // Hide cookie consent popup

};

}

Next, create a new element on your page and add the following code to it:

cookieConsent { background-color: rgba(0, 0, 0, 0