Skip to main content

Integration

Cookie banner for Shopify with the Customer Privacy API

Last reviewed

Short answer

A Shopify store that sells to EU customers needs consent before analytics and marketing tracking, for example Google Analytics, Google Ads, Meta Pixel, TikTok and most app pixels. Limes adds a balanced banner via one script in theme.liquid, sets Google Consent Mode v2 automatically, and lets you pass the decision to Shopify's Customer Privacy API so Shopify's own pixels and apps respect it.

Install
theme.liquid <head>
Checkout
Necessary cookies stay on
Consent Mode v2
Automatic
Pricing
Sessions, not product count

Setup

  1. Back up the theme

    Duplicate your live theme as a backup in Online Store > Themes > Duplicate.

  2. Paste the script

    Open Edit code > Layout > theme.liquid and paste the Limes script directly below the opening <head> tag.

  3. Turn off Shopify's banner

    Disable Shopify's built-in cookie banner in Settings > Customer privacy so customers only see one banner.

  4. Add a settings link

    Add a "Cookie settings" link in your footer.

Passing consent to Shopify's Customer Privacy API

Shopify's own analytics, Web Pixels and many apps read consent from the Customer Privacy API. Forward the Limes decision so that they behave consistently with your banner:

Forward Limes consent to Shopify (theme.liquid, after the Limes script)
window.addEventListener('limes:change', (event) => {
  const s = event.detail.selection;
  window.Shopify?.loadFeatures?.(
    [{ name: 'consent-tracking-api', version: '0.1' }],
    (error) => {
      if (error) return;
      window.Shopify.customerPrivacy.setTrackingConsent(
        { analytics: s.statistics, marketing: s.marketing, preferences: false, sale_of_data: s.marketing },
        () => {}
      );
    }
  );
});

Shopify's checkout does not run theme scripts. Consent captured on the storefront reaches checkout pixels through the Customer Privacy API, which is why forwarding matters.

Pricing that does not punish large catalogues

Shops often have thousands of product and collection URLs. Limes bills on sessions and domains, not pages, so a large catalogue costs the same as a small one with the same traffic. Starter covers 25,000 sessions for €12/month; Professional covers 150,000 sessions across 3 domains.

Frequently asked questions

Does checkout still work if a customer declines cookies?

Yes. Cart, session, currency and checkout cookies are strictly necessary and stay active. Google tags receive Consent Mode signals. Theme scripts you mark with data-limes-category wait for consent. Shopify's own pixels and apps follow the decision once you forward it to the Customer Privacy API.

Is Shopify's built-in banner enough?

Shopify's banner covers Shopify's own tracking. Theme scripts and third-party tags you add yourself are not automatically blocked, and the design options are limited. Check whether it covers everything you load.

Do Shopify apps respect Limes consent?

Apps that use Shopify's Customer Privacy API do, once you forward the Limes decision as shown above. Apps that inject their own scripts run regardless of Limes, so check each app's consent settings.

Add Limes to your Shopify theme

Free for one store up to the Free session limit. No payment details.

Free up to 2,500 sessions. No payment details.