Shopify: Meta, TikTok or GA4 pixels fire before the cookie banner
Why tracking pixels can run before consent on a Shopify store, how to check it in your browser, and how to fix it with Shopify's own privacy settings.
Lukas Kontur · · 7 min read
Shopify has a built-in cookie banner and a system that holds back tracking pixels until a visitor agrees. When it is set up correctly, pixels from apps such as Facebook & Instagram, TikTok or Google & YouTube wait for consent. Yet many stores still send data to Meta, TikTok or Google the moment a page opens. This guide shows you how to spot it, the five usual causes, and how to fix each one in the Shopify admin.
The symptoms
- A scan report shows trackers before consent, for example requests to
facebook.com/tr,analytics.tiktok.comorgoogle-analytics.com, or cookies such as_fbp,_ttpor_ga, before any banner click. - The Meta Pixel Helper or TikTok Pixel Helper extension shows events on page load while the banner is still open.
- Visitors from the EU see no banner at all, but your pixels still run.
In our scan of 97,304 EU websites, 31.1% set analytics cookies and 18.3% set marketing cookies before the visitor made any choice (full study).
How to check it yourself
- Open a new private window in Chrome, so you arrive with no cookies and no earlier consent.
- Press F12 to open DevTools and click the Network tab.
- Load your store. Do not click the banner.
- Type each of these into the filter box, one at a time:
facebook,tiktok,collect,hotjar. Anything listed fired before consent. Shopify runs some pixels inside a hidden sandbox frame, but DevTools still shows their requests here. - Open the Application tab, then Cookies, then your store's address. Look for
_fbp(Meta),_ttp(TikTok) and_ga(Google Analytics). Shopify's own cookies are listed in its cookie policy:_shopify_analyticsis a reporting cookie and_shopify_marketinga marketing cookie, so they should not be set before consent either where a banner is required. - Check whether a banner appeared at all. If you are testing from an EU country and no banner shows, jump to cause 1 below.
Why it happens
1. The banner is not shown in your visitors' region
In the admin, Settings, Customer privacy, Cookie banner, there is a Use automated settings option under Regions and content. According to Shopify, the automated settings cover visitors in the UK and EEA when your store has active markets there (Shopify Help: customer privacy settings). If you sell to EU customers but never set up an EU market, check the regions by hand.
2. A third-party banner app does not match Shopify's settings
If you use a consent app instead of Shopify's banner, Shopify asks you to remove its own banner and to set custom banner regions that match your app. Its help page warns: "If these regions don't match, then non-essential data can be processed before a visitor provides consent." (Shopify Help: customer privacy settings). The app also has to pass the visitor's choice to Shopify through the Customer Privacy API (Shopify Help: app pixels).
3. A custom pixel is set to "Not required"
Pixels you add yourself live under Settings, Customer events, Custom pixels. Each one has a Permission setting: Required (you then choose marketing, analytics or preferences) or Not required (Shopify Help: manage custom pixels). A Meta or TikTok pixel set to Not required runs without waiting for consent.
4. Tracking code is pasted into the theme
Code added directly to theme.liquid or a theme section runs as part of the page. Shopify's consent system applies to web pixels (app pixels and custom pixels): in regions that need consent, "web pixels run only when website visitors have provided the permissions required in the pixel configuration" (Shopify Help: custom pixel code). A script in the theme is not a web pixel, so it is not held back unless the code itself checks consent.
5. The same pixel is installed twice
For example the Facebook & Instagram app plus an old snippet in the theme, or the Google & YouTube app plus a GTM container. The app version waits for consent, the old copy does not.
The fix
Work through these in order and test after each step.
Step 1: turn on and check the cookie banner
- Go to Settings, Customer privacy, Cookie banner.
- Under Regions and content, either keep Use automated settings (if your EU and UK markets are set up) or use Edit under Regions to select every region you sell to. Click Done, then Save.
- Use View in the Position section to preview what visitors will see. Shopify requires a published privacy policy before the banner can be used.
If you use a consent app instead, open the menu (three dots) on the same page, remove the Shopify banner with Remove cookie banner, set Set custom banner regions to exactly the regions your app covers, and confirm with the app's support that it syncs consent through the Customer Privacy API. For example, the Pandectes listing states an integration with the "Shopify Privacy API" (Shopify App Store).
Step 2: use the sales channel apps instead of pasted code
Connect Meta, TikTok and Google through their official Shopify apps (Facebook & Instagram, TikTok, Google & YouTube). They install app pixels, and Shopify loads an app pixel only when the visitor has given every permission the app declared (Shopify developer docs: pixel privacy). You can see what an app declared under Settings, Customer events, via View customer privacy, but you cannot change it. For Google, Google's own help says consent mode "should work automatically" with the Google & YouTube app when your banner integrates with the Customer Privacy API (Google Tag Manager Help).
Step 3: move every other script into a custom pixel with "Required"
For a tracker without an official app (for example Hotjar or a smaller ad network):
- Go to Settings, Customer events, open the Custom pixels tab and add a new custom pixel. Give it a name and click Add pixel.
- Paste the vendor's code into the Code window, in the way Shopify describes for custom pixels.
- Set Permission to Required and tick the matching purpose: Marketing for ad pixels, Analytics for analytics and session recording.
- Click Save, then Connect pixel (Shopify Help: manage custom pixels).
Since February 2025, Meta pixels that were entered on the Online Store Preferences page have been converted into custom pixels (Shopify Help: pixel migration). If you have one of those, open it and check its permission setting. Code pasted into the theme was not converted; see step 4.
Step 4: remove the old copies from the theme
- Go to Online Store, Themes, click the three dots next to your live theme and choose Edit code.
- Open
theme.liquidand search forfbq(,ttq.,gtag(,googletagmanager.comandhotjar. - Remove any tracking code that is now handled by an app or a custom pixel. Keep a copy in a text file first, in case you need to roll back.
If a developer needs to keep a script in the theme, it has to check consent itself through the Customer Privacy API. See our guide on Shopify Decline not being honoured for a code example.
How to verify the fix
- Before any click (new private window): the filters
facebook,tiktok,collectandhotjarshow nothing, and there is no_fbp,_ttpor_gacookie. - After Decline (or your banner's wording for rejecting) and a reload: still nothing, on the home page, a product page and the cart.
- After Accept (new private window): the requests and cookies appear. This proves your ads still get data from visitors who agree.
- Shopify's own test: open a custom pixel under Settings, Customer events and click Test. The Shopify Pixel Helper may show "Pixel is awaiting consent" until you accept, which is what you want (Shopify Help: testing custom pixels). To see the banner again, clear your cookies.
For background on the finding itself, read Pre-consent tracking explained.
Check your site in 1 minute
Our free scan opens your store in a clean browser from the EU, records every pixel and cookie before and after the banner, and tells you which one fired too early. No signup needed. Run a free scan.
Get alerted when it breaks
Installing a new app or changing your theme can bring a pixel back before consent. With monitoring, we re-scan your store on a schedule and email you when that happens. Create an account and add your store.
Last updated: