A common claim about Shopify Web Pixels: they are fine for analytics, but blind for ads, because they “can’t read cookies or click IDs”. Shopify’s own documentation says otherwise. A pixel can read first-party cookies and the page URL. What it can’t do is run before consent, touch the DOM, or carry a click ID from the landing page to the order on its own. The real limit is not access. It is orchestration.

What a Web Pixel can and cannot do

Need In a Web Pixel? How (Shopify doc)
Read _fbp, _fbc and other first-party cookies Yes browser.cookie.get(name), an asynchronous method that runs in the top frame
Read gclid, fbclid, UTM parameters Yes event.context.document.location.search (or href)
Know the order, its value and currency Yes checkout_completed: data.checkout.order.id, totalPrice, currencyCode
Email and phone of the buyer Yes, with scopes data.checkout.email / phone (read_customer_email, read_customer_phone for app pixels)
Read or change the DOM No The pixel runs in a sandbox
Run without consent (EEA, UK) No “Web pixels run only when website visitors have provided the permissions required in the pixel configuration”

Sources: Web Pixels API: browser, init (context, customer privacy), checkout_completed, custom pixel permissions.

So where does ad tracking break?

Three places, and none of them is “the pixel can’t see the IDs”:

Step 1: capture the click IDs on landing

In a custom pixel (Settings > Customer events), read the URL and the Meta cookies on page_viewed, and keep them for the rest of the visit:

analytics.subscribe("page_viewed", async (event) => {
  const params = new URLSearchParams(event.context.document.location.search);
  const gclid = params.get("gclid");
  const fbclid = params.get("fbclid");
  if (gclid || fbclid) {
    // keep the click IDs until the order (use localStorage if buyers often switch tabs)
    await browser.sessionStorage.setItem("click_ids", JSON.stringify({ gclid, fbclid }));
  }
});

Step 2: send the order and the IDs to your server

analytics.subscribe("checkout_completed", async (event) => {
  const checkout = event.data.checkout;
  const ids = JSON.parse((await browser.sessionStorage.getItem("click_ids")) || "{}");

  fetch("https://your-endpoint.example.com/conversions", {
    method: "POST",
    keepalive: true,
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      event_id: event.id,              // Shopify customer event ID
      order_id: checkout.order?.id,    // null on every event except checkout_completed
      value: checkout.totalPrice?.amount,
      currency: checkout.currencyCode,
      email: checkout.email,           // raw here, hashed on the server
      fbp: await browser.cookie.get("_fbp"),
      fbc: await browser.cookie.get("_fbc"),
      gclid: ids.gclid || null,
      fbclid: ids.fbclid || null
    })
  });
});

Step 3: let the server talk to the ad platforms

Where an App Embed still helps

An app embed block is the theme extension that apps use for “analytics, or tracking pixels” with no visible UI. It is useful when you need a vendor SDK (fbq, gtag) to run on storefront pages. But Shopify is explicit: “Theme app extension app blocks and app embed blocks can’t be rendered on checkout pages.” So it can’t replace the pixel for the purchase, and it is not needed just to read cookies or click IDs. Shopify: theme app extension configuration

A clean architecture for ad tracking on Shopify

Shopify’s sandbox did not remove the identifiers. It removed the shortcuts. You now have to capture, keep and forward them on purpose.

Related reading

Sources

Not sure your own tracking is right?

Book a call Or start with the free analytics audit →