Tracking

Shopify web pixels and customer events, explained

How Shopify customer events and web pixels work: app vs custom pixels, the standard events, a code example, GA4 mapping and the Optimized data setting.

·7 min read·By the ROASaurus team

Key takeaways
  • Shopify Pixels (the pixels manager under Settings › Customer events) is where every tracking script on a Shopify store now runs, including checkout.
  • App pixels are installed by apps; custom pixels are code you or a developer paste in. Both run in a sandbox and receive the same standard events.
  • Standard events such as product_viewed, product_added_to_cart, checkout_started and checkout_completed map neatly onto GA4 ecommerce events.
  • App pixels now default to an "Optimized" data sharing setting that can pause data when Shopify sees little signal; set a pixel to "Always on" if it must receive every event.
  • Pixels are still browser code: ad blockers and consent apply, so purchases should also go out server-side from the order.

Shopify customer events are the actions shoppers take on your store, such as viewing a product, adding to cart or completing checkout. Shopify publishes them to web pixels: small tracking scripts that you manage under Settings › Customer events in the Shopify admin, instead of pasting code into your theme or checkout. Every pixel, from Meta's to your analytics tool's, receives the same events and runs in a sandbox Shopify controls.

This guide explains what Shopify Pixels are, the difference between app and custom pixels, the standard events, an example custom pixel, how to map the events to GA4, and the data sharing setting Shopify added for app pixels.

What is "Shopify Pixels"?

A pixel is a piece of code, almost always JavaScript, that passes what shoppers do on your store to another service for marketing or reporting: the Meta Pixel, the GA4 tag, the TikTok Pixel, an affiliate network's tag. For years those scripts lived in theme files and in the checkout's Additional scripts box. Nobody could see in one place which scripts were installed, what data they took or whether they still worked.

Shopify Pixels changes that. Pixels are added in one place in the admin, Shopify sends them the events, and you can see, pause or remove each one. For a store owner the benefits are:

  • Events without custom code. Shopify publishes product views, cart changes, checkout steps and purchases itself, so a pixel only has to listen.
  • One overview. Every pixel on the store, with who added it and whether it is connected.
  • Consent in one place. Each pixel declares which permissions it needs (marketing, analytics, sale of data), and Shopify only runs it when the visitor's choice allows it.
  • No code in theme files. Apps no longer inject scripts into the theme, so a theme update cannot break tracking and an uninstalled app leaves nothing behind.
  • Custom events when you need them. A developer can publish extra events from the theme for things Shopify does not track by default.

App pixels and custom pixels

App pixels
  • Installed by an app, with no copy and paste
  • Run in a strict sandbox: they cannot read the page or load other scripts
  • Show under the App pixels tab
  • Have a data sharing setting (Optimized or Always on)
Custom pixels
  • Code you or a developer paste in under Add custom pixel
  • Run in a looser sandbox (an iframe) that can load third-party scripts
  • Show under the Custom pixels tab
  • Run as written, without Shopify's optimization
Both receive the same customer events. The difference is who manages the code and how much it is allowed to do.

Neither kind can read the page around it. A pixel cannot see the landing URL of the checkout window or the cookies of the storefront the way a theme script could. That is the trade-off for safety: tracking that depends on the original page has to collect what it needs earlier, on the storefront, and carry it along.

The standard customer events

Shopify publishes a fixed set of standard events. These are the ones tracking setups use most:

Customer eventWhen it fires
page_viewedAny page loads, storefront or checkout
product_viewedA product page is viewed
collection_viewedA collection page is viewed
search_submittedA search is made
product_added_to_cartA product is added to the cart
cart_viewedThe cart page is viewed
checkout_startedCheckout begins
checkout_contact_info_submittedThe shopper enters contact details
checkout_shipping_info_submittedA shipping method is chosen
payment_info_submittedPayment details are submitted
checkout_completedThe order is placed (thank-you page)
A selection of Shopify's standard events; the full list is in Shopify's developer documentation.

How to add a custom pixel

  1. Open Customer events

    In the Shopify admin go to Settings › Customer events and click Add custom pixel. Give it a clear name, such as the service it sends to.

  2. Set the permissions

    Choose whether the pixel needs marketing or analytics permission, and whether its data counts as a sale of data. Shopify then only runs it for visitors whose choice allows it.

  3. Paste the code

    The code subscribes to the events it needs with analytics.subscribe and sends them on.

  4. Save and connect

    Click Save, then Connect. Until it is connected, the pixel does not run.

  5. Test it

    Place a test order and check that the event arrives at its destination. Tools that look inside the page, such as browser extensions for a pixel, may not see code that runs in the sandbox.

Code example: a simple custom pixel

This example listens for checkout_completed and posts the purchase to an endpoint of your own. It is a sketch to show the structure, not a ready-made integration:

Custom pixel: send the purchase to your own endpoint
// Settings › Customer events › Add custom pixel (example: log the purchase to your own endpoint)
analytics.subscribe('checkout_completed', (event) => {
  const checkout = event.data.checkout;
  fetch('https://collect.example-shop.com/purchase', {
    method: 'POST',
    keepalive: true,
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({
      event_id: event.id,
      order_id: checkout.order && checkout.order.id,
      value: checkout.totalPrice && checkout.totalPrice.amount,
      currency: checkout.currencyCode,
    }),
  });
});

Three things to notice. The pixel only subscribes, it never scrapes the page. Each event has its own id, which you can reuse as the event id so a server-side copy of the purchase is not counted twice. And keepalive lets the request finish even when the shopper closes the tab right after checkout.

Mapping customer events to GA4

If you set up GA4 through a custom pixel, translate each Shopify event into the matching GA4 ecommerce event:

Shopify customer eventGA4 eventMain parameters
page_viewedpage_viewpage location, title
product_viewedview_itemitems, value, currency
collection_viewedview_item_listitems, list name
search_submittedsearchsearch_term
product_added_to_cartadd_to_cartitems, value, currency
checkout_startedbegin_checkoutitems, value, coupon
checkout_shipping_info_submittedadd_shipping_infoshipping tier
payment_info_submittedadd_payment_infopayment type
checkout_completedpurchasetransaction_id, value, tax, shipping, items
Use the order id as transaction_id on purchase, so GA4 can drop a second copy of the same order.

The "Optimized" data sharing setting for app pixels

In early 2026 Shopify changed the default data sharing setting for app pixels from Always on to Optimized. Custom pixels are not affected. In Optimized mode, Shopify watches whether a pixel's data seems to be used for traffic or sales attribution, and it can limit or pause the events it shares with that pixel when it sees little signal. The aim is to stop forgotten apps from collecting data nobody uses.

The side effect: an app pixel that forwards events to its own server, which then sends them on to Meta or Google, can look idle to Shopify, because Shopify cannot see that forwarding. Shopify does not notify you when it pauses a pixel; you notice it as fewer events in the destination.

  1. Open the app pixels

    Go to Settings › Customer events and select the App pixels tab.

  2. Check the Data column

    Each app pixel shows its data sharing setting.

  3. Switch to Always on where it matters

    Click the value and choose Always on for pixels you rely on for tracking and attribution. Leave unused pixels on Optimized, or remove the app.

Server-side delivery from the order, such as Meta's Conversions API fed by an order webhook, does not go through a pixel and is not affected by this setting.

Pixels are still browser code

Customer events make tracking tidier, but a pixel still runs in the shopper's browser. Ad blockers can stop its requests, a visitor who declines consent will not trigger it, and a shopper who pays on an external page and never returns may not fire checkout_completed at all. That is why a sound setup also sends the purchase from the paid order on the server, with the same event id as the pixel. Server-side tracking for Shopify explains how the two fit together.

How ROASaurus uses customer events

Theme app embedRecords click ids and UTM tags on the storefront, and saves a visitor id on the cart
ROASaurus app pixelStrict sandbox: forwards checkout_started, contact info and checkout_completed
Optional custom pixelLoads browser pixels in checkout and Google Ads enhanced conversions
Order webhookThe paid order goes out server-side with the same event id
The app pixel and the custom pixel use the same event ids, so running both never counts a purchase twice.

When you install the ROASaurus Shopify app, it creates its app pixel for you. The pixel declares that it needs marketing permission and follows the visitor's choice during checkout. The optional custom pixel, which you add under Settings › Customer events with a snippet from Connections › Tracking & destinations, adds browser pixels in checkout. Because the ROASaurus app pixel forwards events to ROASaurus rather than straight to an ad platform, set it to Always on in the App pixels tab. Purchases themselves go out from the paid order, so they still reach the ad platforms if a pixel is paused. Each delivery and its response are listed in Data quality › Deliveries.

Next step

Sources

  1. Shopify Help Center: Pixels overview
  2. Shopify Help Center: App pixels
  3. Shopify Help Center: Manage your custom pixels
  4. Shopify Changelog: New default setting for pixel data sharing
  5. Shopify developers: Web pixels standard events
  6. Google Analytics: Measure ecommerce (GA4 events)

In ROASaurus

Keep reading

TrackingServer-side tracking for Shopify: why and howWhy Shopify stores need server-side tracking and how it works: what the browser misses, the orders/paid webhook, deduplication, consent and setup.Tracking"No recent conversions" in Google Ads: causes and fixesWhat "No recent conversions" (now "Awaiting conversions") means in Google Ads, how to tell a quiet week from a broken tag, and the fix.TrackingCookieless tracking for online stores: what still worksCookieless tracking for online stores: server-side events, modeling and fingerprinting compared, what each still measures and what consent requires.

FAQ

Questions, answered

More answers in the FAQ and the help center.

What are Shopify customer events?

Customer events are actions shoppers take on your store, such as viewing a product, adding to cart or completing checkout. Shopify publishes them to the pixels you add under Settings › Customer events.

What is the difference between an app pixel and a custom pixel?

An app pixel is installed and managed by an app and runs in a strict sandbox. A custom pixel is code you paste in yourself; it runs in a looser sandbox that can load third-party scripts.

Can I set up GA4 with a Shopify custom pixel?

Yes. Subscribe to the standard events, translate each one to the matching GA4 event (for example checkout_completed to purchase), and read the page location from the event data because the pixel runs in an iframe.

What does the Optimized data sharing setting do?

For app pixels, Shopify can limit or pause the events it shares when it sees little sign that the data is used for attribution. Set a pixel to Always on in the App pixels tab if it must receive every event.

Are custom pixels affected by the Optimized setting?

No. The setting applies to app pixels only. Custom pixels run as written, and server-side events sent from the order do not go through a pixel at all.

Do Shopify pixels work with ad blockers?

Not always. Pixels still run in the shopper's browser, so ad blockers and declined consent can stop them. Sending purchases from the order on the server fills that gap.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.