Fix guide · Shopify · medium · about 30 min
Meta Pixel not firing after cookie consent on Shopify
For the finding “Meta Pixel does not fire after consent”. Also for: Any website, WordPress, Webflow, Framer.
What this means
The Meta Pixel (still often called the Facebook Pixel) is on your Shopify store, but after cookies were accepted, no events were sent to Meta. As far as Meta is concerned, this page has no visitors.
Why it costs you money:
- Meta cannot see page views or conversions from this page, so campaigns optimize without data and reported results are too low.
- Retargeting audiences built from store visitors stop growing.
How sure we are: if our checker found and accepted your cookie banner, this is reported as critical. If we did not find a banner we could operate, it is reported as high: the pixel may be waiting for a banner we did not recognize. Test it yourself before changing anything.
On Shopify, the banner records the visitor’s choice through Shopify’s Customer Privacy API, and Shopify then starts the pixels under Settings > Customer events that have the permissions they need. For app pixels, such as the one from Meta’s Facebook & Instagram app, Shopify documents that it replays the events that already happened on the page, so a PageView should arrive right after “Accept”, without a reload. If nothing arrives, a link in that chain is broken.
How to confirm it yourself
Our check runs from a browser in the EU. Shopify shows its banner based on where the visitor is (with automated settings, in the EEA and the UK), so if you are elsewhere, use a VPN with a European location or ask a colleague in the EU.
- Open your store in a private (incognito) window, open developer tools (F12), go to the Network tab and type
facebook.com/trinto the filter box. - Load the page and click Accept on the cookie banner.
- Wait a few seconds. You should see at least one request with
ev=PageView(in Chrome possibly of typeping). If nothing appears, the pixel does not fire after consent. - Open the Console tab and run
Shopify.customerPrivacy.currentVisitorConsent(). After “Accept”,marketingshould be"yes". If it is empty or"no", the banner did not pass the choice to Shopify. If the console reports thatShopify.customerPrivacyis undefined, nothing on the page has loaded the Customer Privacy API, which usually means the banner is not connected to it. - Click to another page. If events only appear now, the pixel starts one page too late, and you lose the first page of every new visit (often the ad landing page).
The same test tells you whether the Meta Pixel is working on your Shopify store at all: a PageView request with your pixel ID (id in the payload) right after “Accept” means it works on that page. Repeat it on a product page and after adding to cart.
Meta Ads Data Advisor (Meta’s Chrome extension, formerly Meta Pixel Helper) and the Test events tool in Meta Events Manager (Data sources > your pixel > Test events) show the same from Meta’s side. For custom pixels, Shopify’s Pixel Helper (click Test on the pixel under Settings > Customer events) also shows whether the pixel is still waiting for consent.
How to fix
-
Check that the banner records the choice. After clicking “Accept”, reload: the banner should not come back. If two banners appear (Shopify’s and a consent app’s), keep one and turn the other off.
-
If you use a consent app, check its settings or documentation for its integration with Shopify’s Customer Privacy API. Shopify’s pixels, including the Facebook & Instagram app’s pixel, learn about consent only through that API. Without the integration, they keep waiting in regions where Shopify requires consent.
-
Check that “Accept” grants what the pixel needs. Under Settings > Customer events, open the menu next to the Facebook & Instagram app pixel (or any app pixel) and choose View customer privacy. For a custom pixel, open it and check the Customer privacy section. A pixel only runs when the visitor has given every permission it requires; if it requires one your banner never grants (for example Preferences), it never starts. The console check above shows what was granted.
-
Check that the pixel is connected. The Facebook & Instagram app’s pixel needs customer data sharing turned on (Sales channels > Facebook & Instagram > Settings, then the data sharing settings) with your pixel selected. A custom pixel must be connected; if it shows a Connect button, it is not.
-
Check the custom pixel code. Shopify’s sandbox runs JavaScript only, so remove
<script>,<noscript>and any other HTML from Meta’s base code. In Shopify’s example,PageViewis sent from apage_viewedsubscription:analytics.subscribe("page_viewed", (event) => { fbq('track', 'PageView'); });If the code throws an error, the Pixel Helper shows a red dot for that event.
-
If GTM sends the Meta tag:
- GTM as a custom pixel: Shopify notes that Google Tag Assistant does not detect tags inside a custom pixel, so test with the Network tab instead. The custom pixel’s permissions (step 3) decide when GTM can run.
- GTM in
theme.liquid: the Meta tag often has only a page view trigger, which runs once, before the visitor clicks “Accept”. Add a trigger for the data layer event your consent setup pushes when consent is given (GTM Preview shows its name), keep the tag’s consent requirement, and set it to fire once per page.
-
If the pixel is in theme code behind a consent check, make sure the check also reacts when consent is given on the current page (Shopify’s Customer Privacy API publishes a
visitorConsentCollectedevent when consent changes), not only to consent that existed when the page loaded. The simpler fix is to remove the code from the theme and use the Facebook & Instagram app’s pixel. -
Look at the Console for errors from
fbevents.jsor your own code, then save your changes and publish GTM if you changed it.
Common causes
- A consent app is not integrated with Shopify’s Customer Privacy API, so Shopify never learns that the visitor accepted.
- Two banners are active, and the visitor answers the one Shopify does not listen to.
- The pixel requires a permission that the banner’s “Accept” does not grant.
- A custom pixel contains HTML tags or a code error, or is disconnected.
- A GTM Meta tag fires only on the initial page view, before consent, and never again on that page.
How to verify the fix
- In a fresh private window with a European location: no
facebook.com/trrequests before “Accept”, aPageViewrequest within a few seconds after “Accept” on the same page, andcurrentVisitorConsent()showsmarketing: "yes". - Reload the page:
PageViewis sent on load, without clicking anything. - Re-run the check on IsPixelWorking. The issue should be gone, and “Meta Pixel fires before cookie consent” should not appear in its place.
Sources
- Shopify.dev, About web pixels (in consent regions, app pixel callbacks run after consent and earlier events are replayed): https://shopify.dev/docs/apps/build/marketing/pixels
- Shopify.dev, Customer Privacy API (
setTrackingConsent,currentVisitorConsent,visitorConsentCollected): https://shopify.dev/docs/api/customer-privacy - Shopify.dev, Pixel privacy (a pixel loads only with every permission it declares as required): https://shopify.dev/docs/api/web-pixels-api/pixel-privacy
- Shopify Help Center, Pixels overview: https://help.shopify.com/en/manual/promoting-marketing/pixels/overview
- Shopify Help Center, App pixels (View customer privacy): https://help.shopify.com/en/manual/promoting-marketing/pixels/app-pixels
- Shopify Help Center, Manage your custom pixels: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/manage
- Shopify Help Center, Create custom pixel code (JavaScript only; Meta pixel example): https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/code
- Shopify Help Center, Testing custom pixels (Pixel Helper, awaiting consent): https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/testing
- Shopify Help Center, Create a Google Tag Manager custom pixel (Tag Assistant limitation): https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/gtm-tutorial
- Shopify Help Center, Configuring customer privacy settings: https://help.shopify.com/en/manual/privacy-and-security/privacy/customer-privacy-settings/privacy-settings
- Shopify Help Center, Facebook data sharing: https://help.shopify.com/en/manual/promoting-marketing/analyze-marketing/meta-data-sharing
- Google Tag Manager Help, Tag Manager consent mode support: https://support.google.com/tagmanager/answer/10718549
- Meta Business Help Center, Test events tool: verify app and web browser events for Meta: https://www.facebook.com/business/help/2040882565969969