How to add cookie consent to Shopify

You do not need a monthly consent app to put a GDPR cookie banner on your Shopify store. Here is the whole setup: where to host the file, where to paste the code, and how to keep your pixels honest.

A guide by The Cookie Shooter. Practical guidance, not legal advice.

Step 1: upload the script to Files

In Shopify admin, go to Content → Files and upload the-cookie-shooter.js. Shopify hosts it on its CDN. Copy the file URL, it looks like https://cdn.shopify.com/s/files/.../the-cookie-shooter.js.

Step 2: add it to theme.liquid

Go to Online Store → Themes → Edit code and open layout/theme.liquid. Paste this right before the closing </body> tag:

<script>
  window.TheCookieShooterConfig = {
    siteName: "My Store",
    cookiePolicyUrl: "/policies/privacy-policy",
    lang: "auto"
  };
</script>
<script src="https://cdn.shopify.com/s/files/.../the-cookie-shooter.js" defer></script>

Save, and the banner is live on every page of the storefront. Because theme.liquid wraps the whole theme, you only add it once.

Step 3: gate your pixels

For consent to mean anything, marketing pixels must not fire before the visitor accepts. On Shopify, trackers usually come from three places:

Shopify also has built-in Customer Privacy settings (Settings → Customer privacy) with region rules. If you enable those too, align the regions with your banner so visitors are not asked twice.

Test it

Open the store in a private window. The banner should appear, and before you accept, no marketing pixels should fire (check the Network tab). Accept, reload, and confirm your pixels now load and the banner stays away.

Common mistakes on Shopify

A Shopify-friendly banner

One file on your CDN, one tag in theme.liquid, no app subscription. The Cookie Shooter blocks pixels until consent and adds none of its own.

Get The Cookie Shooter See the live demo

Frequently asked questions

Do I need an app for cookie consent on Shopify?

No. A lightweight script in theme.liquid works without any app. Consent apps exist, but most add monthly fees and weight.

Does it work with Shopify's own privacy settings?

Yes. The banner is the visible consent step. If you use Shopify's Customer Privacy region rules too, keep them consistent so visitors are not asked twice.

Will it slow down my store?

No. It is a single dependency-free file, and pixels held until consent can make the first load faster.