Skip to main content

WEBINARNavigating Consent Mode V2: How Should I Prepare?

|

30 April, 2024

3 pm CET (8 am CT)

Register now

Getting Started

How to Add a Cookie Policy to Wix

This guide will walk you through how you can generate and add a cookie policy page on your Wix website. A cookie policy is a document that provides detailed disclosure about the types of cookies used on a website and their purposes. It will help your website comply with privacy laws like the GDPR and ePrivacy Directive.

To begin with, Sign up on CookieYes and try it for free.

Note: After you sign up, you will be directed to the installation screens. You can install the cookie banner to get GDPR compliant for your use of cookies. If you want to create a cookie policy first, then skip the installation and proceed to the app dashboard.

You can also follow the step-by-step instructions below to easily add a cookie policy to your Wix website.

How to generate a cookie policy for Wix website

Step 1. From your app’s navigation bar, click on More and select Cookie Policy Generator.

Step 2. You can edit the Heading under the ‘Types of Cookies’ section. The setting to Show ‘Cookie audit table’ is enabled by default. This will add a detailed cookie list to your policy. Now, click Save & Proceed.

cookieyes cookie policy for wix website

Step 3. In this section, you can edit details, including the Heading, Description and Effective date of your cookie policy. 

cookieyes cookie policy for wix website

Note: The ‘Revisit consent widget’ is a widget that will enable your website visitors to manage their cookie preferences. You can remove the code in the field if you don’t want a widget to be displayed.

Step 4. Now click Generate to see your final cookie policy.

cookieyes cookie policy for wix website

Step 5. You can see your Cookie Policy (Preview). Select Copy text or Copy html to copy the cookie policy.

cookieyes cookie policy for wix website

Note: Your cookie audit table will be visible in your cookie policy after you paste the copied HTML code on your website.

You can go ahead and paste the HTML or text on a new cookie policy page or add it as a section within your privacy policy page.

Your cookie policy will now be auto-updated every time you scan your website on CookieYes.

GDPR Compliance

To be GDPR compliant for your use of cookies, you should install a cookie banner on your website and obtain consent before deploying cookies on your visitor’s devices.

To install the banner, from the top navigation bar, click on More > Site Settings > Installation Code > Copy code

Refer: How to add cookie banner on Wix

How to add a cookie policy page on the Wix website

Step 1: Head to your Wix account and open your site’s Dashboard. Then select Edit Site.

Wix dashboard

Step 2:  To add a new page to your site, select Menu & Pages icon from the side panel. Now click +Add Page.

Wix editor to add new page

Step 3: Select +Blank Page and add the name as ‘Cookie Policy’ in the title field and click Done.

wix editor to add blank page

Step 4: In the newly created page, click on the ‘Add‘ (plus icon) from the side panel and then select Embed code > Embed HTML.

wix editor to add html code

Step 5: Select the HTML block, click on Enter Code and add the copied HTML here.

wix editor to add cookie policy page

To activate the Cookie Setting button, follow the below steps:

  1. Locate the anchor element with the inner text “Cookie Settings” within the HTML code of your Cookie Policy page.
  2. Replace that anchor element with the below-provided code snippet.
  3. In the provided code, replace “https://parent-domain.com” with your website domain.
  4. Click the “Update” button to apply the changes.
<a class="cky-banner-element" onclick="window.parent.postMessage({message:'cookieyes-settings'}, 'https://parent-domain.com/')">Cookie Settings</a>
HTML code of cookie policy

Step 6:  To display the cookie Audit table under the “Types of cookies we use“, follow the below steps:

  1. Add the following script at the top of the cookie policy page. Replace the https://parent-domain.com with your domain and click Update.
<!-- start cookie policy page script -->
<script type="text/javascript">
  (() => {
    function e(t, n) {
      const a = document.getElementsByClassName(t);
      if (a) return n(a);
      setTimeout(() => {
        e(t, n);
      }, 500);
    }

    window.addEventListener &&
      window.addEventListener("load", () => {
        e("cky-audit-table-element", () => {
          window.parent.postMessage(
            { message: "get-audit-table" },
            "https://parent-domain.com"
          );
        });
      });

    window.addEventListener(
      "message",
      (e) => {
        if (
          "https://parent-domain.com" !== e.origin &&
          "audit-table-content" !== e.data.message
        )
          return;

        document.getElementsByClassName(
          "cky-audit-table-element"
        )[0].innerHTML = e.data.html;
        document.head.insertAdjacentHTML(
          "beforeend",
          `<style id="cky-audit-table-style">${e.data.style}</style>`
        );
      },
      false
    );
  })();
</script>
<!-- end cookie policy page script -->

2.1. Add the following custom code in the Wix Settings. Replace the https://iframe-domain.filesusr.com with your iframe domain.

<script>
(() => {
  function e(t, n, i = false, o = false) {
    const s = o ? document.getElementById(t) : document.querySelector(t);
    if (s && !i || (s && i && ["", " ", "&nbsp;"].indexOf(s.innerHTML) === -1)) return n(s);
    setTimeout(() => {
      e(t, n, i, o);
    }, 500);
  }
  
  window.addEventListener("load", () => {
    document.body.insertAdjacentHTML(
      "afterBegin",
      '<div class="cky-audit-table-element" style="display: none;"></div>'
    );
  });
  
  window.addEventListener("message", (t) => {
    if ("https://iframe-domain.filesusr.com" !== t.origin) return;
    if (t.data.message === "cookieyes-settings") {
      window.revisitCkyConsent();
      return;
    }
    if (t.data.message === "get-audit-table") {
      e('[title="Embedded Content"]', (t) => {
        e(".cky-audit-table-element", (n) => {
          e("cky-audit-table-style", (e) => {
            t.contentWindow.postMessage(
              {
                html: n.innerHTML,
                style: e.innerHTML,
                message: "audit-table-content",
              },
              "https://iframe-domain.filesusr.com"
            );
          }, true, true);
        }, true);
      });
    }
  }, false);
})();
</script>

To get your iframe domain from the Wix website, refer.

2.2. If you have provided any text in the field “What’s in the embed?” of HTML Settings where you have inserted the cookie policy code, you need to replace the attribute value of title="Embedded Content" conditional check within the event listener (line 25) of the above code snippet.

For example, if you have entered “Demo Content” in the field “What’s in the embed?“, modify the code as shown below:

<script>
(() => {
  function e(t, n, i = false, o = false) {
    const s = o ? document.getElementById(t) : document.querySelector(t);
    if (s && !i || (s && i && ["", " ", "&nbsp;"].indexOf(s.innerHTML) === -1)) return n(s);
    setTimeout(() => {
      e(t, n, i, o);
    }, 500);
  }
  
  window.addEventListener("load", () => {
    document.body.insertAdjacentHTML(
      "afterBegin",
      '<div class="cky-audit-table-element" style="display: none;"></div>'
    );
  });
  
  window.addEventListener("message", (t) => {
    if ("https://iframe-domain.filesusr.com" !== t.origin) return;
    if (t.data.message === "cookieyes-settings") {
      window.revisitCkyConsent();
      return;
    }
    if (t.data.message === "get-audit-table") {
      e('[title="Demo Content"]', (t) => {
        e(".cky-audit-table-element", (n) => {
          e("cky-audit-table-style", (e) => {
            t.contentWindow.postMessage(
              {
                html: n.innerHTML,
                style: e.innerHTML,
                message: "audit-table-content",
              },
              "https://iframe-domain.filesusr.com"
            );
          }, true, true);
        }, true);
      });
    }
  }, false);
})();
</script>

Step 7: Now you can Preview your cookie policy page and click on Publish.

Your cookie policy page will be live on your Wix website. You can then link your cookie policy to your website footer or link it within your cookie banner.

If you are facing issues with the Cookie Policy Generator, then contact technical support.