How to add cookies on Shopify

Sharing is caring!

How to add cookies on Shopify

Looking for a guide who can show you in detail how to add cookies on Shopify? Alright, good news: you just found it! In this in-depth analysis, we will give you all the instructions to integrate the cookies banner to collect consent to the use of cookies and implement the preventive blocking of it (as required by the Cookie Law).

We will rely on Iubenda (read How to use Iubenda), a simple tool that allows website owners to adapt their Shopify portal to GDPR and other privacy regulations. So take a few minutes of free time: we are sure that once you finish reading the article, you will have a clearer picture of everything.

We remind you that with Iubenda you can totally delegate the management of the privacy of your site to a single service, made up of lawyers who do their daily work and update – if necessary – its content. Through our link you will receive a 10% discount on your first purchase: Iubenda offer

How to add cookies on Shopify

How to add cookies on Shopify-2

The aforementioned cookie law essentially requires you to display a cookie banner, i.e. a brief notice that must appear on the user’s first visit, and to block scripts that install cookies before have obtained the consent of the user. In the next lines we will see in detail how to add cookies on Shopifyie within your e-commerce created with the service in question (see also Iubenda Gratis. Here’s how to get it).

You will first need to enable the “Limit monitoring of European customers” option in the online store > Preferences, after which you can start the actual procedure. Here are all the steps, point by point:

  • Generate your own cookie policy
  • Generate the cookie banner
  • Add the Cookie Solution snippet to your Shopify theme
  • Configure cookie blocking for other scripts in use

Let’s analyze each of these operations in detail.

Generate your own cookie policy

The first step to getting your Shopify site up and running is to generate the cookie policy. To do this, go to the Iubenda dashboard and click on [Il tuo sito] > Privacy and cookie policy> Edit. You will notice a box labeled “Cookie Policy” (you can find it in the right column), and clicking “Activate cookies policy”A window will automatically open containing some recommended settings. Save changes: Your cookie policy will be generated automatically based on your privacy policy configuration.

Generate the cookie banner

The second step to understand how to add cookies on Shopify is to click “Generate Now” in the dashboard > [Il tuo sito] > Solutions to cookies. Once this is done, you will arrive on the cookie banner configuration panel: once the customization of the cookie banner is complete, Save and Copy the code obtained. You will get something like this:

<script type="text/javascript">    var _iub = _iub || [];    _iub.csConfiguration = {        "countryDetection": true,        "consentOnContinuedBrowsing": false,        "perPurposeConsent": true,        "lang": "it",        "siteId": 11223344, //usa il tuo siteId        "cookiePolicyId": 55667788, //usa il tuo cookiePolicyId        "floatingPreferencesButtonDisplay": "bottom-right",        "banner": {            "acceptButtonDisplay": true,            "customizeButtonDisplay": true,            "rejectButtonDisplay": true,            "position": "float-top-center"        }    };</script><script type="text/javascript" src="https://cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script>

Before you paste it into your Shopify theme, you need to do a few additions (note the two “code for Shopify” sectionswith lines onPreferenceFirstExpressedCallback, _iub.csConfiguration.callback and Tracking API):

<script type="text/javascript">    var _iub = _iub || [];    _iub.csConfiguration = {        "countryDetection": true,        "consentOnContinuedBrowsing": false,        "perPurposeConsent": true,        "lang": "it",        "siteId": 11223344, //usa il tuo siteId        "cookiePolicyId": 55667788, //usa il tuo cookiePolicyId        "floatingPreferencesButtonDisplay": "bottom-right",        "banner": {            "acceptButtonDisplay": true,            "customizeButtonDisplay": true,            "rejectButtonDisplay": true,            "position": "float-top-center"        }    };    <!-- codice per Shopify (1 di 2) -->    var onPreferenceFirstExpressedCallback = function(consent) {        if (true == _iub.csConfiguration.perPurposeConsent) {            consent.consent = Object.keys(consent.purposes).every(function(k) {                return consent.purposes[k]            });        }        window.Shopify.customerPrivacy.setTrackingConsent(consent.consent, function() {});    }    if (typeof _iub.csConfiguration.callback === 'object') {        _iub.csConfiguration.callback.onPreferenceFirstExpressed = onPreferenceFirstExpressedCallback;    } else {        _iub.csConfiguration.callback = {            onPreferenceFirstExpressed: onPreferenceFirstExpressedCallback        };    }</script><script type="text/javascript" src="https://cdn.iubenda.com/cs/iubenda_cs.js" charset="UTF-8" async></script><!-- codice per Shopify (2 di 2) - Tracking API --><script type="text/javascript">    window.Shopify.loadFeatures([{            name: 'consent-tracking-api',            version: '0.1',        }, ],        function(error) {            if (error) {                throw error;            }        });</script>

Add the Cookie Solution snippet to your Shopify theme

At this point, to add the Cookie Solution snippet to your Shopify theme, you can use a plugin to add custom code to your pages. You can also change your theme manually.

Configure cookie blocking for other scripts in use

Before installing cookies, it is necessary to block the associated scripts that you have added to the pages and then release them only when the user has given their consent. Also because there are few categories of cookies that do not require consent.

How to put cookies on shopify

How to add cookies on Shopify-3

You should now have a complete and comprehensive overview of how to add cookies on Shopify. It only remains for us to make an appointment for the next one, hoping that our guide has been useful to you in practice. Here is a guide that might work for you: Alternatives to Iubenda

We remind you that with Iubenda you can totally delegate the management of the privacy of your site to a single service, made up of lawyers who do their daily work and update – if necessary – its content. Through our link you will receive a 10% discount on your first purchase: Iubenda offer

See also  Alternatives to YouTube Advanced | InfoDrones.It

Leave a comment

2 × 2 =