TRACKING SPECIALIST — BARIS ASA · LONDON
Synctag
Start the check → TRACKING SPECIALIST — BARIS ASA · LONDON

READING ROOM › FIELD NOTE › NOTE-062

NOTE-062 · FIELD NOTE FILED 22 NOV 2026 · REVISED 22 NOV 2026 F-301 F-204 F-101 F-102

Headless and custom Shopify storefronts: what the front end must send for GA4 and ad platforms to see a purchase.

ABSTRACT — On a headless Shopify store the purchase happens in Shopify's checkout, not in your front end. The front end sends page views, product views and cart events; a checkout pixel sends the checkout steps and the purchase; the visitor's identity and consent have to cross between the two. Who sends what on Hydrogen and custom builds, an owner check, and how to test without the Pixel Helper.

Baris Asa, tracking consultant, London · Last checked: November 2026

On a headless Shopify store, the purchase happens in Shopify’s checkout, not in your front end. The front end must send page views, product views and cart events itself. Shopify’s checkout fires checkout_completed, and a checkout pixel turns it into GA4 purchase and Meta Purchase. The visitor’s identity and consent must cross from your domain to the checkout. When GA4 or Meta shows no purchases, or purchases from “direct”, one of those three parts is missing.

“Headless” here means a front end you build yourself on Shopify’s Storefront API, with or without Shopify’s Hydrogen toolkit, and Shopify’s own checkout behind it. Not sure that’s you? Go to checkout: if the address changes to a checkout. subdomain or another domain, and your developer talks about Hydrogen, Next.js or the Storefront API, it is. This note is for the owner who needs to know which part is broken, and for the developer who builds the fix.

Is your headless store losing purchases? A check from GA4 and Shopify admin

No code. You need GA4 and Shopify admin (plus Meta Events Manager and Google Ads for check 6), and the same 7 days in each.

  1. Browsing without buying. GA4, Reports > Monetization > Ecommerce purchases (or the matching sales report, if your property uses the Business objectives collection). Look at item views, add-to-carts and purchases. Fault if: views and add-to-carts come in but purchases are zero or far below your Shopify orders. The checkout part is missing: F-301 from the other end. Start at where the purchase comes from.

  2. Buying without browsing. Same report. Fault if: purchases come in but item views or add-to-carts are zero. The front-end part is missing. Start at what the front end sends. On file as F-301 .

  3. Purchases from nowhere. GA4, Reports, Acquisition, Traffic acquisition, with Key events set to purchase. Fault if: most purchases sit under Direct, or under Referral from your own checkout domain or a payment provider. The visitor’s identity broke on the way to checkout. Start at the handover. On file as F-204 .

  4. More purchases than orders. Fault if: GA4 shows more purchases than Shopify shows orders. Two things send the purchase, often an app and a custom pixel. On file as F-101 .

  5. Shopify’s own reports look empty. Shopify admin, Analytics, Reports, Sessions over time. Fault if: sessions are far lower than GA4’s or missing. Shopify’s reports depend on the front end sending Shopify analytics events; on Hydrogen, no page view is sent unless your code publishes it.

  6. The ad platforms. Meta Events Manager: Purchase events against Shopify orders for the same 7 days. Google Ads: the status of the purchase conversion action. Fault if: Purchase is missing or outnumbers orders, or the Google Ads action isn’t recording conversions.

If two or more checks fail, start with the event map. Someone has to own which system sends which event.

Who sends what on a headless Shopify build?

EventWhere it happensWho sends it
Page view, every route changeYour front endYour code
Product, collection, search and cart viewsYour front endYour code
Add to cart, remove from cartYour front end’s cartHydrogen derives them, in whichever framework hosts it; hand-built front ends, your code
Checkout steps and purchaseShopify’s checkoutA Customer Events pixel (app or custom)
ConsentBothShopify’s Customer Privacy API

The split exists because the checkout is Shopify’s page, not yours. Your front end creates the cart with the Storefront API, and the cart’s checkout URL sends the customer to Shopify’s web checkout (Shopify: manage a cart).

What must the front end send?

Which Hydrogen you run matters. Shopify rewrote Hydrogen’s analytics: its older pages say they “refer to Hydrogen versions 2026-04 and earlier”, and 2026-10 onwards works differently. Ask your developer which version is in package.json.

Hydrogen 2026-10 and later (Shopify: add analytics and consent):

  • ShopifyScripts loads the Customer Privacy API, the privacy banner and Shopify’s analytics, and creates one analytics bus for the page. Shopify analytics is the only destination that ships by default.
  • Page views are your job. ShopifyScripts doesn’t publish them. Your app publishes PAGE_VIEWED on the first load and on every client navigation. If it doesn’t, Shopify analytics and destinations like GA4 record no page views.
  • View events come from your routes. Product, collection, search and cart views are published from the route that has the data, and a cart drawer counts as a cart view. Every product needs id, title, price, vendor, variantId, variantTitle and quantity, or Shopify analytics skips the event.
  • Cart events are derived for you. Hydrogen publishes add-to-cart and remove-from-cart after Shopify confirms the cart change. Don’t publish them yourself, or they double.
  • GA4, Google Ads and Meta are destinations you add with addDestination(). The bus runs only in the browser and delivers to destinations only when consent allows.
  • Consent covers destinations only. Shopify: “Scripts that you load separately need their own consent handling.” A GTM snippet pasted into the page layout is outside the gate.

Hydrogen 2026-04 and earlier (Shopify: legacy tracking guide): <Analytics.Provider> wraps the app with the cart, shop and consent settings. Analytics.ProductView, CollectionView, SearchView and CartView sit on each route, and third-party code subscribes through useAnalytics. Shopify’s GTM recipe for this version subscribes to an event and pushes it to the dataLayer (Shopify: GTM recipe).

Next.js, Nuxt and other frameworks. Current Hydrogen is a toolkit you add to a framework that runs server code; Shopify starts templates on React Router or Next.js and shows the analytics setup for Next.js and Vue (Shopify: Hydrogen). The rules above apply unchanged. Only a front end built straight on the Storefront API, without Hydrogen, sends everything itself. The hydrogen-react package, whose reference is versioned 2026-04, has sendShopifyAnalytics, which accepts two event names, PAGE_VIEW and ADD_TO_CART, and sends nothing without consent (Shopify: sendShopifyAnalytics). For GA4 and the ad platforms, a hand-built front end pushes one dataLayer event per step in the shape GTM can read (GA4 ecommerce dataLayer in GTM).

Every one of these front ends is usually a single-page app, so the URL changes without a page load. Count each view once, not twice: GA4 page views not tracked on a single-page app.

Where does the purchase come from?

Not from Hydrogen. Its analytics event list has page, product, collection, search and cart views and cart changes, and no checkout or purchase event (Shopify: AnalyticsEvent).

The purchase is checkout_completed, a Customer Events (Web Pixels) event. It fires once per checkout, typically on the Thank you page; with a post-purchase upsell, on the first upsell page (Shopify: checkout_completed). Plan every headless build the same way: front-end code sends browsing, a checkout pixel sends checkout steps and the purchase. (Shopify lists the Storefront, Checkout, Thank you and Order status pages as where pixels load, and that page doesn’t mention headless front ends: Shopify: pixels overview.)

That pixel is one of two kinds:

  • An app pixel, from a channel app such as Facebook & Instagram. Check what each app sends before adding a second sender: Shopify tracking apps: what each one sends. For Google & YouTube, Shopify’s help page warns that headless storefronts can cause domain verification problems and tells merchants to contact Google for guidance on a headless architecture (Shopify: connect Google & YouTube).
  • A custom pixel you write, often with GTM inside. It runs in Shopify’s sandbox and only passes on what its code hands over. Google doesn’t support GTM there. The limits are in GTM in a Shopify custom pixel.

If browser limits are the real problem, the purchase can also come from the server: Shopify server-side tracking compared.

The front end and the checkout are two sites. Three things must survive the move, or purchases land under Direct.

1. Put the checkout on a subdomain of the storefront. Shopify’s legacy Hydrogen consent guide (2026-04 and earlier): if the store is example.com, assign checkout.example.com to checkout, so customer preferences stay consistent across storefront and checkout (Shopify: consent). It also says the storefront must query the Storefront API under the same origin, because Shopify’s consent and analytics cookies are HTTP-only. Current Hydrogen requires the Storefront API proxy for the same reason; without it, Shopify says analytics and checkout session continuity are incomplete. The subdomain stays the safe default for GA4, below.

2. Keep one GA4 visitor across both. Google’s tag sets its cookie on the highest domain level by default, so a visit is measured across subdomains with no extra setup (Google: customise cookies), unless someone changed the tag’s cookie domain. A checkout on a different root domain needs cross-domain measurement and the _gl link parameter (Google: cross-domain), and Google says cross-domain measurement may not work from a Shopify custom pixel (Google: custom pixel limitations). The subdomain avoids both problems. Payment providers that bounce the customer back go on GA4’s unwanted referrals list (Google; F-205 ). Click IDs have their own route through checkout: Do gclid and fbclid survive your checkout?.

3. One consent decision for both. On a custom front end, the Customer Privacy API’s setTrackingConsent takes headlessStorefront: true, the checkout and storefront root domains and a Storefront API access token (Shopify: Customer Privacy API). On current Hydrogen, the consent prop picks default-banner, custom-banner or no-banner; with no-banner, visitors in regions that require consent can’t grant it, so events never reach destinations. If the site’s Content Security Policy blocks cdn.shopify.com, the privacy script can’t load and, again, nothing reaches destinations.

One event map for both senders

Two systems send events to the same GA4 property, so write one table of names and fields before anyone codes. My minimum:

  • One property, one web stream, one measurement ID in the front end and the checkout pixel.
  • GA4’s names on both sides. Shopify’s own GTM mapping pairs product_viewed with view_item, product_added_to_cart with add_to_cart, checkout_started with begin_checkout and checkout_completed with purchase (Shopify: GTM custom pixel).
  • The same item_id everywhere. Pick variant ID or SKU and use it in both senders, or GA4’s item reports split one product in two.
  • A complete purchase. GA4 requires transaction_id and items, each item with item_id or item_name, and needs value with currency for revenue to report (Google: purchase event). Use the Shopify order ID. GA4 deduplicates purchases with the same transaction ID; an empty string is never a valid ID (Google). Value mismatches across platforms: F-302 .
  • One purchase sender per platform. Meta’s Purchase needs value and currency (Meta: pixel reference). If a browser pixel and the Conversions API both send it, they must share event_name and event_id to be deduplicated (Meta: deduplication); see F-102 .

How to test a headless build without the Pixel Helper

The Shopify Pixel Helper isn’t compatible with headless commerce stores (Shopify: testing pixels). Test in three places.

  1. Shopify analytics. Browser DevTools, Network, filter monorail-edge.shopifysvc.com. A produce_batch request means events reach Shopify. Shopify skips requests from Chrome Lighthouse, so synthetic checks show nothing (Shopify).
  2. GA4 from the front end. Filter Network on collect; each request’s en value is the event name. Click through a product, a collection and the cart without reloading. One page_view per route change, one view_item per product page. Watch it arrive in GA4 DebugView (Google: DebugView).
  3. The checkout. Place a test order. In DebugView, check begin_checkout and purchase arrive once, with the order ID, value, currency and items. In Meta Events Manager, Test events, check Purchase arrives once with value and currency. Then compare the _ga cookie value on the storefront and on the checkout subdomain: the same value means one visitor, not two.

A pass: every step in the event map arrives once, in one property, and the test purchase lands under the source you clicked from.

When to bring someone in

A headless build has more owners than a theme store: a front-end developer, whoever set up the apps, and whoever runs the ads. The purchase crosses all three, and nobody owns the handover.

A headless tracking audit, part of my Shopify tracking work, checks five things: the event map across both senders, the checkout pixel, consent on destinations and on separately loaded scripts, the checkout subdomain and _ga continuity, and purchases against Shopify orders in GA4, Google Ads and Meta. Your developer gets the event map, the checkout pixel spec and a test-order sign-off. To start, send GA4 read access and your answers to the six checks above.

Common questions

Does Hydrogen send the purchase event to GA4?

No. Hydrogen’s analytics event list covers page views, product, collection, search and cart views, and cart changes. It has no checkout or purchase event. The purchase happens in Shopify’s checkout, where checkout_completed is a Customer Events (Web Pixels) event, so an app pixel or custom pixel sends it.

What does a headless Shopify front end have to send itself?

A page view on the first load and on every client-side navigation, product, collection, search and cart views from the routes that have the data, and cart changes. On current Hydrogen, cart events are derived from the cart for you; page views and view events are published by your code.

Should the checkout be on a subdomain of my headless storefront?

Yes. Shopify’s legacy Hydrogen consent guide (2026-04 and earlier) says to assign a checkout subdomain, such as checkout.example.com for a store on example.com, so customer preferences stay consistent across storefront and checkout. Google’s tag also measures across subdomains of one domain by default, unless its cookie settings were changed.

Can I use the Shopify Pixel Helper on a headless store?

No. Shopify says the Pixel Helper isn’t compatible with headless commerce stores. Test the front end in the browser’s Network panel and GA4 DebugView, and test the checkout with a real test order.

Only if they are registered as Hydrogen analytics destinations. Shopify says the consent gate covers Hydrogen destinations and that scripts you load separately need their own consent handling.

Can the Google & YouTube app track a headless Shopify store?

Shopify’s help page for the app warns that headless storefronts can cause domain verification problems when the storefront domain differs from the one configured in Shopify, and tells merchants to contact Google for guidance on a headless architecture. Check before relying on it.

Sources

Read on 22 November 2026:

— B.A., filed from London

CONNECTED RECORDS F-301 F-204 F-101 F-102

REVISION HISTORY — revised 22 NOV 2026.

← back to the reading room