Cookie compliance integration for Shopify

Nelson
Written by NelsonLast updated 1 day ago

There are three ways to install CookieScript on Shopify:

By using a Shopify app

By modifying a template file on Shopify

By using the Google Tag Manager (GTM) Tag template.

We recommend using the Shopify app or GTM, since they make it easier to update CookieScript later and to enable Google Consent Mode.

Note: If one method doesn't work for you, try a different one. Use only one method to install CookieScript. If you switch from one method to another, remove the previous script first.

Method 1: Installing CookieScript via Shopify app

To make installing CookieScript easier, we have created a Shopify app. To install it, follow these steps:

  1. Log in to your Shopify admin.

  2. In the left menu, under Apps, click Add:

    1_add%20apps.png
  3. In the Picked for you window, click Shopify App Store at the bottom:

    2_shopify%20app%20store.png
  4. In the Search field, type CookieScript and select the CookieScript app:

    3_search.png
  5. Click Install:

    4-install.png
  6. Review the data the app needs access to and click Install to add the CookieScript app to your store:

    5-install.png
  7. To finish the installation, you need your CookieScript banner code. In your CookieScript account, open your banner and go to Install:

    image.png
  8. Configure geo-targeting.

  9. Select Shopify and click Copy code.

  10. Return to the CookieScript app in your Shopify admin, paste the copied CookieScript source URL, and click Add:

    6-add.png
  11. Enable Google Consent Mode v2 by selecting the checkbox:

    shopify%20consent.png

    Once enabled, you can control the settings of Google Consent Mode separately.

All done! The CookieScript app is now installed on Shopify and ready to use.

Method 2: Installing CookieScript on Shopify by editing theme files

Shopify doesn't allow external scripts on checkout pages, including the Thank you and Order status pages, so with this method the CookieScript code runs on your storefront pages only. Follow these steps:

  1. In your CookieScript account, open your banner and go to Install.

    image.png
  2. Configure geo-targeting.

  3. Select Script tag and click Copy code.

  4. Log in to your Shopify admin.

  5. In the left menu, click Online Store.

  6. Next to your current theme, click the ... button and choose Edit code:

    shopify1.png
  7. In the layout folder, open theme.liquid:

    shopify2.png
  8. Paste the copied CookieScript code right after the opening <head> tag, so that it loads before all other scripts.

  9. Click Save.

Note: The code editor may underline the CookieScript line with a warning (for example, about a parser-blocking script). This is expected: CookieScript has to load before other scripts so it can block cookies until the visitor gives consent.

CookieScript is now installed on Shopify and ready to use.

Note: If the banner doesn't appear after installation, check whether a caching app or browser extension is preventing it from showing.

Common problems: If you have issues with the Cart, add the following cookies to the CookieScript cookie declaration as strictly necessary cookies:

Shopify%20cart.png

Method 3: Installing CookieScript using the GTM Tag template

Read this guide on how to install CookieScript on Shopify using the GTM Tag template.

This method allows you to implement Google Consent Mode on your website easily.

Did this article help you solve your issue?