Google Consent Mode and tracking

Shopify pixels firing before consent: how to check and fix

Shopify pixel firing before consent? See which tags follow Shopify's Customer Privacy API, which ones bypass it in the theme, and how to test your store.

By Hamza Ahmad Aslam

Published

7 min read

Sources checked 13 Nov 2026

A shop front with a consent gate: two tracking tags wait behind it while a third slips past early

A Shopify store tracks before consent when a tag sits outside Shopify's consent system. Pixels added under Settings, Customer events wait for the visitor's choice through the Customer Privacy API. Tags pasted into theme.liquid, or loaded by an app's own script, run with the page and can set cookies such as _fbp before the banner is answered.

That split explains most "my pixel fires before consent" reports on Shopify. The fix is usually to move the tag, not to change the banner.

Because some tags never ask Shopify whether they may run. Shopify holds back the pixels it manages, but a script written into the theme loads like any other part of the page.

Shopify's pixels manager runs app pixels and custom pixels in a sandbox and, in markets configured to require consent, only lets them run once the visitor has given the permissions the pixel needs. Shopify's help page on pixels says code snippets can be used to bypass customer consent requirements, and that doing so violates the Shopify Terms of Service. A Meta Pixel pasted into theme.liquid is that kind of snippet: it loads as the page loads, whatever the banner says.

When the Meta Pixel uses first-party cookies, Meta's developer documentation says it saves a unique identifier to an _fbp cookie on your domain if one doesn't exist yet. Seeing _fbp before anyone has clicked Accept is therefore a good sign that Meta's code ran outside Shopify's consent control.

Which tags does Shopify hold back, and which does it not?

Shopify holds back the pixels in its pixels manager. It cannot hold back code that runs outside that manager.

Where the tag lives How it gets there Waits for consent in regions that require it?
App pixel Installed by a marketing or analytics app, listed under Settings, Customer events Yes, based on the pixel's privacy settings
Custom pixel Added by you under Settings, Customer events Yes, if its Permission setting is Required (the default)
Theme code Pasted into theme.liquid or another theme file No. It runs when the page loads
An app's own storefront script Added by an app outside the pixels manager Only if the app checks consent itself

Two settings decide what a custom pixel does. As of 13 November 2026, Shopify's help pages say new custom pixels require Marketing and Analytics permission by default, and that the Permission setting can be changed to Not required. A custom pixel switched to Not required runs without waiting for consent, even though it sits in the pixels manager.

Shopify's own cookie banner covers the same ground. Its help page says the banner governs Shopify-specific tools, including cookies and Shopify pixels, and that manually installed third-party cookies or pixels, or ones integrated through apps, may need a third-party banner or custom logic to honor consent.

How do you check your store?

Load the store as a new visitor and look at what is set before you touch the banner. It takes about five minutes.

  1. Open your storefront in a private or incognito window, so no earlier choice is stored.
  2. Before clicking anything on the banner, open DevTools (F12) and go to Application, then Cookies, then your store's domain.
  3. Look for advertising and analytics cookies such as _fbp (Meta) or _ga (Google Analytics). If they are already there, something ran before consent.
  4. Open the Network tab, reload the page, and filter for facebook, google, tiktok or the name of the tool you use. Requests listed before your choice show which scripts loaded early.
  5. Click Reject on the banner, reload, and repeat steps 2 to 4. Nothing optional should come back.
  6. Run the free cookie consent checker on the same page for a second view. It loads the page as a first-time visitor and reports cookies set before consent and tracker tags written into the HTML.

If you are in a region your banner doesn't cover, you may see no banner at all. Shopify's privacy settings let you pick the regions where its banner shows, so test from, or set your banner to show in, a region that requires consent.

How do you find a pixel hardcoded in the theme?

Search the theme code for the tracker's own script. Shopify's help center gives the path: from your Shopify admin, go to Online Store, click the ⋯ button next to your theme, then Edit code.

Open layout/theme.liquid first, since it loads on every storefront page. Search for:

  • fbq( or connect.facebook.net for the Meta Pixel
  • gtag( or googletagmanager.com for Google tags
  • ttq or analytics.tiktok.com for TikTok
  • <script in general, to see every inline script and what it loads

Then search the snippets folder, because themes often include tracking code from a snippet. If a tag sits there, note what it is before you remove anything.

Replace the theme snippet with an app pixel or a custom pixel, then delete the snippet. Shopify's guide to custom pixels asks you to remove existing pixel code first, from places such as theme.liquid and the Additional scripts in checkout settings, so events aren't counted twice.

  1. Check whether the vendor has a Shopify app with an app pixel. Shopify recommends reviewing apps before writing a custom pixel.
  2. If not, go to Settings, Customer events, and add a custom pixel with the vendor's JavaScript. Shopify's sandbox runs JavaScript only, so remove any HTML from the vendor's code.
  3. Under Customer privacy, Permission, leave Required selected and pick the purposes the pixel needs, usually Marketing for ad pixels and Analytics for analytics.
  4. Save, then click Connect.
  5. Remove the old code from theme.liquid and any snippet, and save the theme.
  6. Repeat the check above.

If a tag has to stay in the theme, a consent tool can still hold it back, as long as the tool's script loads first. CookieConsentHQ's Shopify guide shows how to mark a theme script as type="text/plain" with a data-cchq category, so it only runs after the visitor accepts that category.

Shopify's own tools: its cookies and the pixels in its pixels manager. Its help page is explicit that third-party code installed by hand, or through apps, may need more.

New stores get automated privacy settings, which Shopify says configure the cookie banner for visitors in the UK and EEA when the store has active markets there. You can change the regions and the text under Settings, Customer privacy, Cookie banner. If you use a third-party banner app, Shopify asks you to set the same consent regions in its settings and in the app. Its help page warns that if the regions don't match, non-essential data can be processed before a visitor provides consent.

Through the Customer Privacy API. A banner app records each visitor's choice there, and Shopify applies it to the pixels it manages.

Shopify's developer documentation describes setTrackingConsent for recording a choice, and asks that consent is only recorded on a visitor interaction, never automatically on the visitor's behalf. CookieConsentHQ's Shopify app does that on each Accept, Reject or save in preferences, never on page load. It passes analytics and marketing as chosen, preferences from the functional category, and the sale-of-data choice from marketing. Shopify then decides which app and custom pixels may run.

The app adds the banner through a theme app embed, so you don't edit theme code to install it. It covers storefront theme pages. Shopify checkout pages can't render app embeds, so the banner doesn't show there. The Shopify integration page has the install steps.

Common questions

Why is _fbp set before the banner is answered?

Usually because the Meta Pixel is in the theme or added by an app outside the pixels manager. Meta's documentation says the pixel saves the _fbp identifier when it loads with first-party cookies on.

Not on its own. Shopify says its banner governs Shopify's tools and pixels, and that code installed by hand or through apps may need a third-party banner or custom logic.

Will moving my Meta Pixel to Customer events lose data?

Some features, such as automatic form scraping, may not work in Shopify's sandbox, according to its pixels overview. Standard events like page views, add to cart and purchases are supported.

The guide to cookies set before consent covers causes outside Shopify, and the cookie scanner runs scheduled checks on your own site. If the banner doesn't appear at all, see cookie banner not showing.

Run the free checker on your site

Check your site

Sources