Articles on: Frequently Asked Questions (FAQ)

How to block Klaviyo from collecting information?

In order to block the tracking from Klaviyo so that no information is being collected if a customer has opted out of the Marketing cookie group, you would need to add an additional script in your main theme file. Here are the steps that you would need to follow:

Open Shopify Admin.
Click on Online Store link in the left menubar.
Click on the Action dropdown button and select Edit Code from there.
A new page will open with a list of files on the left side of the screen. Open the theme.liquid file.
Find the string </head> in there.
When you do, you can copy and add the following snippet before </head>:

<script>
function checkGDPRKlaviyo() {
      if (window.isenseGDPR !== undefined && window.isenseGDPR.Cookies.get('cookieconsent_preferences_disabled') !== undefined) {
        let cookie = window.isenseGDPR.Cookies.get('cookieconsent_preferences_disabled');
        if (cookie.indexOf('marketing') == -1) {
          document.cookie = "__kla_off=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
        } else {
          document.cookie = "__kla_off=true"; 
        }
      } else {
        setTimeout(function() {
          checkGDPRKlaviyo();
        }, 500);
      }
    }

    checkGDPRKlaviyo();

    window.addEventListener('click', function (e) {
      if(e.target && (e.target.className == 'cc-btn cc-btn-accept-all' || e.target.className == 'cc-btn cc-allow' || e.target.className == 'cc-btn cc-btn-accept-selected')){
        checkGDPRKlaviyo();
      }
    });
</script>



Click on the "Save" button.

For additional reference on how the script works, feel free to check the documentation for Klaviyo here - About Cookies in Klaviyo

How the script works? - We are setting the Klaviyo cookie __kla_off to true, which should stop Klaviyo from tracking onsite activity data, if the customer has opted out of the Marketing cookie group through our app.

Once you’ve successfully added the script, you need to add the Klaviyo cookie __kla_id into our app by navigating to Cookie Bar tab > Cookies Management section.

If you are a paid plan user, you can add the cookie from the Cookie Information Panel, as shown below:



For free users, you may add the cookie directly to the Cookie Categories, as shown below:



If you have any questions, don't hesitate to contact our support team at: support@consentmo.com or from the Chat button at the bottom right corner of your browser.

Updated on: 19/12/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!