Shopify Builds>Primitives>Web Pixels API

Web Pixels API

Definition

The Web Pixels API is Shopify's sanctioned way to run analytics code. A pixel runs in a sandbox with no access to the page's DOM, subscribes to standard customer events — product viewed, cart updated, checkout completed — and receives them from Shopify rather than scraping the storefront. It also honors the shop's customer privacy settings and consent state.

Documented at https://shopify.dev/docs/api/web-pixels-api.

How we've used it

The honest picture is that most measurement in these themes is a theme-side event layer, and the sandbox is why: the events that matter here are theme-specific. An add to bag that happens with no page change, a shade quiz whose result is a step worth counting, a cart drawer that also has to refresh a loyalty widget and an installment message — none of that exists in the standard event set. Where the theme is what fires, one rule keeps it honest: intercept the cart request rather than the button, so an add is reported only when the platform actually accepted it. Consent is the other constant. The layer reads the shop's consent state before it sends, so tracking follows the banner rather than the code.

Builds using it

4 gated builds use it; their pages follow.

Related entities

dataLayer · content_for_header · Cart AJAX API