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.”
Как добавить согласие на использование файлов cookie в Wix?
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("
«);
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: