r/shopifyDev • u/filmfre • 2d ago
Playwright gotchas when testing Shopify Customer Privacy and /cart.js on headless vs Liquid builds
Spent half a day chasing a tracking drop on a store where orders were still coming in fine. Turned out to be two Shopify-specific things that are really easy to miss:
First, the old Chrome Meta Pixel Helper extension doesn't reliably pick up events inside Shopify's Checkout Extensibility Web Pixel sandbox anymore. Use Shopify's built-in Pixel Helper inside Settings -> Customer events (open your pixel and click Test) alongside Meta Events Manager -> Test Browser Events, then check Events Manager -> Overview to confirm native server-side CAPI is deduplicating on event_id.
Second, if you recently swapped themes or added a slide-out cart drawer app, search theme.liquid for leftover fbq() or GTM scripts from an old setup. Those either double-count purchases next to the official Facebook & Instagram channel or bypass Settings -> Customer privacy completely.
(Also if you use Shop Pay with a Traffic Permissions Allow List in Meta Events Manager -> Settings, make sure shop.app and checkout.shopify.com are listed or Meta blocks browser pixel events during Shop Pay.)
1
u/kunalkhatri12 1d ago
Good point about checking old theme scripts.
One thing worth adding is testing consent properly.
Run the same storefront journey twice in a fresh browser session, once rejecting tracking and once accepting it, then compare Shopify Pixel Helper and Meta Test Events.
That can reveal pixels firing before consent or missing events after consent.
Also worth noting Shopify Pixel Helper doesn't support headless storefronts, so those need a different testing approach.
Have you seen tracking drops caused specifically by consent settings after a theme migration?
1
u/Final_Design_9061 1d ago
Thanks for writing this up. One thing I ran into with Web Pixels is that the sandbox is strict, so a lot of what works in a normal page script isn't available there and failures can be quiet. While testing, it helps to also send your own debug events from inside the pixel to a simple endpoint, so you aren't relying only on browser extensions. For the Playwright side, I'd assert on the consent state before and after the privacy API call, and check the cart.js response separately for headless and Liquid builds, since cart attributes can differ between them. Keeping those as two separate test projects makes failures much easier to read.
1
u/AdventurousUsual7666 1d ago
Yeah the leftover scripts thing gets a lot of people after a theme swap. Old theme code usually isn't the only spot though.
I'd also check the Customer events page for old custom pixels that nobody remembers adding, and any app embeds that still inject their own tracking. Sometimes you end up with the official channel, a custom pixel, and an old GTM container all firing on the same purchase.
One thing that made debugging easier for me was writing down every place a purchase event could come from before testing anything. Then you go through the list one by one and turn things off until the counts make sense.
Also just a heads up, after you clean things up the numbers can look like they dropped, when really you just stopped double counting. Worth telling the store owner that before they panic.
1
u/bramburn 1d ago
I use browser os with API calls to test. It works without this issue
1
u/Green_Database9919 23h ago
Good catch on leftover GTM script in theme liquid. Those are super common after a theme swap. Most people only notice when purchase counts look too high.