Skip to main content
GUIDE · SHOPIFY WEB PIXELS API9 min read

Shopify Web Pixels API: the sandboxed way to track 2026 checkout

Shopify’s checkout is now a controlled measurement environment. This guide shows how Web Pixels works, which constraints actually matter, and how TrackLayer turns Shopify-approved customer events into a durable server-side conversion pipeline.

Definition

What Web Pixels API is

Shopify Web Pixels API is Shopify’s supported JavaScript runtime for marketing and analytics pixels. Instead of letting every app inject arbitrary code into checkout, Shopify publishes customer events into a controlled event bus and lets approved pixels subscribe to them from inside a sandbox. In practice, that means the source of truth is no longer whatever your snippet can scrape from checkout markup. The source of truth is the event contract Shopify exposes.

This matters because the old checkout.liquid era rewarded clever hacks that were hard to govern: inline scripts, direct DOM reads, fragile selectors, and a permanent race between app code, theme code, and privacy banners. Shopify’s current model replaces that with constrained execution. Pixels observe standardized customer events such as page views, add-to-cart, checkout progression, and purchase completion. For teams that care about reliable revenue measurement, that is a net improvement. It narrows what pixel code can do, but it makes the event stream far easier to reason about.

The other key shift is that Web Pixels is inseparable from checkout modernization. If you are migrating away from checkout.liquid, you are not just relocating old code. You are adopting Shopify’s privacy-aware analytics model, which is why the right implementation question is not “How do I restore the old snippet?” but “How do I route Shopify’s supported customer events into the destinations the business depends on?”

Constraints

Sandbox constraints

The simplest way to avoid bad migrations is to accept the sandbox’s operating assumptions up front. Teams get into trouble when they treat Web Pixels like a weakened script tag instead of like a new event platform.

No DOM access

Treat the pixel as blind to checkout markup. You are subscribing to Shopify customer events, not querying page nodes, form fields, or Liquid-rendered elements to infer business actions.

No cookie-led identity strategy

Do not design the implementation around setting your own tracking cookies and reading them back across checkout steps. The safe pattern is to rely on Shopify event payloads, approved APIs, and TrackLayer-side identity stitching.

No arbitrary external scripts

The sandbox is not a blank script tag you can use to bootstrap any vendor SDK you want. If a destination matters, send the event to TrackLayer and let TrackLayer handle the downstream API call server-side.

No global window object assumptions

Legacy snippets that expect `window`, direct page globals, or custom checkout state fall apart here. Pixel code has to work from the Web Pixels API surface rather than from browser globals.

Analytics customer events only

The runtime exists to observe supported customer behavior events and privacy state. It is not a general-purpose checkout customization surface, order management API, or app runtime for unrelated business logic.

Implementation

TrackLayer's Web Pixel extension

TrackLayer’s Shopify-approved Web Pixel extension sits inside that sandbox and listens to the standard events that matter for ecommerce measurement. The extension is not trying to outsmart the runtime. It uses the APIs Shopify exposes, captures the customer event payload, records the consent state, and forwards a canonical version of the event into TrackLayer’s server-side pipeline.

That design solves the real migration problem. Most teams do not want a raw Shopify event feed for its own sake. They want a clean purchase signal in Meta, a consistent checkout funnel in GA4, a deduplicated order in TikTok, and a warehouse copy that can be joined against CRM and finance data. TrackLayer is the bridge between Shopify’s constrained event runtime and that broader destination graph. The pixel handles collection inside Shopify’s rules. TrackLayer handles transformation, fan-out, retries, audit visibility, and destination-specific payload logic outside the browser.

Schema

Event namespace

Shopify exposes more than one event, but most teams only need a focused operational subset. The ten events below are the ones TrackLayer usually treats as the spine of storefront and checkout measurement.

Shopify eventTypical schema sliceWhy it matters
page_viewedpageType, url, referrer, contextBaseline pageflow and landing attribution.
product_viewedproductVariant, product, price, currencyProduct-detail engagement and retargeting seeds.
collection_viewedcollection, page metadata, contextCategory browsing and merchandising analysis.
search_submittedsearch query, result contextSearch intent and onsite demand signals.
cart_viewedcart lines, totals, currencyCart funnel monitoring before checkout.
product_added_to_cartline item, quantity, merch contextHigh-intent retargeting and add-to-cart counts.
checkout_startedcheckout token, cart snapshot, totalsEntry into checkout and lower-funnel attribution.
checkout_contact_info_submittedcheckout stage, token, customer snapshotProgression through checkout identity step.
payment_info_submittedcheckout stage, payment step contextLate-funnel progression before purchase.
checkout_completedorder, line items, totals, currency, checkout tokenCanonical purchase signal for optimization and revenue.

If you need refunds, subscription renewals, fulfillment updates, or post-purchase lifecycle state, those usually belong in webhook or backend integrations rather than in the pixel. The pixel should stay focused on the supported customer event stream that Shopify publishes in real time.

Privacy

Consent integration

Consent is part of the runtime, not a side channel. Shopify’s Customer Privacy model determines whether and how pixels load, and customer privacy state can also update during the session. That is exactly why a serious implementation should not bolt on a second consent interpretation layer after the fact.

TrackLayer uses Shopify’s privacy state as an input to event routing. The bridge is straightforward: the Web Pixel extension reads the relevant consent context inside Shopify, attaches that state to the canonical event, and TrackLayer downstream decides how each destination should behave. If marketing consent is absent, the business can still preserve an internal operational event trail while suppressing or reducing what gets sent to advertising endpoints. That keeps privacy logic consistent across browser collection, server dispatch, and later audits.

Install

Installing the extension

Step 1

Install the TrackLayer Shopify app

Add the TrackLayer app from the Shopify App Store or your managed deployment flow. The important outcome is that the store now has an app-level integration path rather than a theme-only or checkout.liquid-era snippet.

Step 2

Enable the Web Pixel extension in Customer events

In Shopify admin, go to Settings → Customer events and confirm the TrackLayer app pixel is connected. That is the switch that places the Shopify-approved pixel into the store’s event pipeline.

Step 3

Review privacy requirements

Confirm the extension is configured against the merchant’s Shopify Customer Privacy settings. If analytics or marketing consent is required, the pixel should load and behave according to those declared requirements rather than custom banner logic.

Step 4

Map destinations in TrackLayer

Inside TrackLayer, connect the destinations that should receive canonical events. This is where Meta Conversions API, Google Ads, GA4, TikTok Events API, and warehouse exports are attached to one normalized Shopify source.

Step 5

Run a test journey end to end

Open the storefront, view a product, add to cart, start checkout, and place a test order. Validate the event sequence in TrackLayer, then confirm downstream platforms received the final routed purchase with the expected event ID, value, currency, and consent state.

Diagnostics

Debugging in sandbox

Debugging a sandboxed pixel is different from debugging a freeform script. The practical workflow is to use Chrome DevTools with the Shopify pixel inspector surfaces, the network panel, and your TrackLayer live stream together. Start by confirming the pixel is actually connected under Shopify Customer events. Then trigger a simple sequence such as product view → add to cart → checkout start. Watch for the event order, payload shape, and whether the consent state changes when the banner is interacted with.

When a sandboxed pixel appears silent, the root cause is usually one of four things: the app pixel is disconnected, the store’s privacy requirements prevent loading, the event you expected is not a standard customer event, or the downstream destination failed after TrackLayer already accepted the event. Keeping those layers separate is what makes debugging tractable. First prove the event exists in Shopify. Then prove TrackLayer received it. Then prove the destination accepted it.

Migration

Migrating from checkout.liquid

Migration gets easier when you classify the old code by job rather than by file. Most checkout.liquid tracking code was trying to do one of a small number of things. Each one now has a different home.

If the old script only listened for funnel events

Move it into the Web Pixel path. Product views, add-to-cart, checkout start, and purchase should be rebuilt from Shopify standard events instead of from DOM listeners.

If the old script injected a third-party browser SDK

Do not try to recreate that inside the sandbox. Send canonical events to TrackLayer and let TrackLayer fan them out server-side to the vendor API.

If the old script scraped checkout fields

Replace it with supported customer events plus protected data access where applicable. Field scraping is the pattern Shopify is deliberately retiring.

If the old script handled refunds or post-purchase ops

Move that logic out of the pixel entirely. Use Shopify order, refund, or app webhooks and merge those events into TrackLayer server-side.

If the old script was really a checkout customization

Use Checkout Extensibility or a dedicated app surface. Web Pixels is for analytics and customer events, not UI behavior or business workflow control.

FAQ

Common questions

Is Web Pixels API the replacement for checkout.liquid tracking?

For analytics and conversion tracking, yes. The mental model changes, though. You are no longer injecting arbitrary checkout JavaScript. You are subscribing to Shopify’s supported customer events inside a sandbox and then forwarding them to the rest of your stack.

Can I still run my ad platform’s browser SDK directly in checkout?

You should not plan around that. The durable pattern is to capture supported Shopify events in the pixel and send them through TrackLayer for server-side delivery. That removes dependence on brittle browser execution in checkout.

Does consent state reach the pixel?

Yes. Shopify exposes customer privacy state to pixels, and TrackLayer uses that state to decide how the event should be forwarded downstream. Consent becomes part of the event contract, not a separate afterthought.

Are refunds or subscription renewals part of Web Pixels?

Not as primary browser checkout events. Those usually belong to Shopify admin events, subscription-app webhooks, or backend lifecycle systems, then flow into TrackLayer as server-side post-purchase truth.

What is the safest canonical purchase event?

For browser-side Shopify checkout measurement, `checkout_completed` is the anchor event. Pair it with stable order and checkout identifiers, then deduplicate against any server-side sources you also emit.

Next reads

Related implementation guides

We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.

We use essential cookies to keep the site secure and functional. Analytics and third-party tags run only with your consent. See our Cookie Policy.