Meta Pixel not tracking purchases on Shopify: the theme.liquid trap
The tracking on this store passes every check you would normally run. GA4 is installed. The Meta Pixel is installed. Pixel Helper lights up on every product page. Meta has still never received a sale from it.
The store is Ashcombe Coffee Roasters, which we built for our public sample report and set up the way a lot of older Shopify stores are, so we can show every finding in full without putting a real business on display. The problem it has is easy to miss, because nothing on the storefront looks wrong, and quick to fix once you know where to look.
The short version: if your pixels were pasted into theme.liquid, they are not on the page where the sale completes. Everything else in this post is how to confirm that on your own store, what it is costing you, and how to move them.
Presence is not tracking
Our free audit reads the HTML each page serves and reports which tags are on it. For Ashcombe it found exactly what you would hope to see:
- GA4: detected on all six pages.
- Meta Pixel: detected on all six pages.
- Universal Analytics: also detected, still loading on every page, three years after Google stopped processing it. We will come back to that.
A tag checker stops here and gives the store a clean bill of health. But every one of those pages is a storefront page: the homepage, a collection, two products, an about page and a blog post. The page that matters most to Meta and GA4, the one a customer sees after they pay, is not one of them. Shopify serves checkout and the thank-you page itself, and that is where the problem is.
Why a pixel in theme.liquid misses the sale
theme.liquid is the layout file for your storefront theme. Pasting a snippet into its <head> puts it on every page your theme renders, which is why this was the standard install advice for years.
Checkout and the thank-you page are not rendered by your theme. Shopify runs them itself and does not load theme.liquid there. So a pixel installed in the theme fires PageView, ViewContent, perhaps AddToCart, and then is simply absent at the moment the order completes. No Purchase ever leaves the browser.
Older setups patched this with a separate Additional scripts box in the checkout settings, which ran on the order status page. Shopify has been retiring that box in favour of Customer events, so a store that has moved to the newer thank-you page loses whatever was pasted there, often without anyone noticing.
What that costs you
Meta can only optimise against the conversions it receives. With no Purchase, a campaign set to optimise for purchases has nothing to learn from, and reported ROAS sits close to zero while the shop is taking orders. It is the kind of fault that gets misread as "Meta ads don't work for us" and a budget quietly switched off.
See the whole report for this store, every tracking finding and every fix, free: the Ashcombe sample audit →
The GA4 version: a purchase without a transaction_id
GA4 on the same store has a quieter problem. Its purchase event does arrive, but without a transaction_id:
// what was sent
gtag('event', 'purchase', { value: 24.50, currency: 'GBP' });
// what GA4 needs
gtag('event', 'purchase', {
transaction_id: '#1042',
value: 24.50,
currency: 'GBP',
items: [ /* ... */ ]
});
GA4 uses transaction_id to recognise a purchase it has already counted. Without it, a customer who reloads the thank-you page or comes back to it from an email can be counted as a second order, and revenue drifts upwards in a way nobody can reconcile with Shopify. If your GA4 shows fewer purchases than Shopify rather than more, the causes are different; we cover all five in GA4 purchase event not firing on Shopify.
The consent problem hardcoded tags create
A snippet in theme.liquid runs the moment the page loads. It does not know your cookie banner exists, so GA4 and the Meta Pixel fire before a visitor has answered it. That is a data problem, because the numbers no longer reflect the choices your visitors made, and in the UK it is a consent one: analytics and advertising cookies need consent first under UK GDPR and PECR.
Pixels installed through Shopify's Customer events, or through the official apps, follow your store's customer privacy settings, so the same move that fixes the missing purchase fixes this too.
Check your own store in five minutes
- Look for theme installs. Open a product page, view the source, and search for
fbevents.js(Meta) andgtag/js?id=G-(GA4). If they are there, open Online Store › Themes › … › Edit code › theme.liquid and search forfbqandgtagto confirm where they live. - Look at what runs on checkout. Open Settings › Customer events. App pixels (from the Facebook & Instagram or Google & YouTube apps) and custom pixels listed here are the ones that run on checkout and the thank-you page. If Meta and GA4 are in your theme but not here, that is very likely your gap.
- Prove it with a test order. Open the Test events tab in Meta Events Manager and GA4 DebugView, then place an order. Look for exactly one
Purchasein Meta and onepurchasein GA4 with atransaction_id. Pixel Helper may show nothing on checkout even when it works, because Customer events pixels run in a sandbox the extension cannot see into, so trust Events Manager over the extension.
The fix, in order
- Install Meta and GA4 where checkout can see them. The simplest route is the official Facebook & Instagram and Google & YouTube apps, which connect to Shopify's own checkout events. The Meta app can also send purchases server-side through the Conversions API, depending on the data-sharing level you choose. If you need something the apps do not do, add a custom pixel under Settings › Customer events that listens for
checkout_completed. - Send the order id with every purchase. The apps do this for you. In a custom pixel, pass the order id as GA4's
transaction_idand as Meta's event ID. - Delete the old snippets. Remove the Meta Pixel and GA4 code from
theme.liquid, and anything left in Additional scripts. Leave them in and everyPageViewis counted twice. - Remove Universal Analytics while you are in there. It has collected nothing since 2023 and still costs a script on every page.
- Place another test order, and check you now see exactly one purchase in each platform, with the order id attached.
Work on a duplicate of your theme if you are editing code, and publish it once the test order comes through clean.
What AuditTag's free audit checks
- GA4 detected in your served HTML
- Google Tag Manager detected
- Google Ads tag detected
- Meta Pixel detected
- A Universal Analytics tag still loading
What this doesn't prove
The audit reads your public pages from outside, so it can see a pixel sitting in your theme but not what is installed under Customer events. It cannot tell you whether a Purchase fires on checkout. That needs a test order, and keeping it right after every theme change or app install is what Guardrails watches.
See which tags are on your store
The free audit reads your public pages and shows which tracking is installed: GA4, Google Tag Manager, Google Ads and the Meta Pixel. It also flags leftovers like an old Universal Analytics tag. It takes about a minute. No account, nothing installed, and it never touches your store.
Check my tracking, free →Want to see the full output first? The Ashcombe sample report shows every finding and every fix for the store in this post.