# Shopify custom pixel validator

> Paste your Shopify custom pixel (Customer events) and check it against the sandbox’s rules: no HTML or Liquid, event names that fire, browser.cookie instead of document.cookie, and purchases Meta and Google count once. Free; nothing leaves your browser.

**Will my Shopify custom pixel fire, and count each sale once?** Paste the JavaScript from Settings → Customer events → your custom pixel. The validator reads it the way Shopify’s sandbox runs it: HTML tags and Liquid that break the whole pixel, event names that never fire, page, cookie and storage calls the sandbox blocks, and purchases without the eventID or transaction_id Meta and Google need to count each sale once.

## What it checks

- HTML pasted from Additional Scripts or a tag manager (<script>, <noscript>, <img>, <!-- -->): a custom pixel takes plain JavaScript, and one tag breaks the whole pixel.
- Liquid ({{ }} and {% %}), which custom pixels never render, with the event.data.checkout replacement for each value (order.id, totalPrice.amount, currencyCode, lineItems).
- Calls the sandbox blocks or answers differently: window.top and window.parent, document.cookie (use browser.cookie), localStorage and sessionStorage (use browser.localStorage / browser.sessionStorage), document.querySelector and jQuery on the storefront's page, window.location (use event.context), dataLayer without its own tag.
- analytics.subscribe event names: Shopify's standard events (page_viewed, product_viewed, collection_viewed, search_submitted, product_added_to_cart, product_removed_from_cart, cart_viewed, checkout_started, checkout_contact_info_submitted, checkout_address_info_submitted, checkout_shipping_info_submitted, payment_info_submitted, checkout_completed, alert_displayed, ui_extension_errored), DOM events and wildcards; ad-platform names such as Purchase or AddToCart, which never fire, are named with the right event.
- fbq, gtag and ttq loaded inside the pixel before they are called.
- Purchases inside checkout_completed: Meta's eventID as fbq's fourth argument (not inside the third), gtag's transaction_id, and value and currency read from the checkout instead of fixed numbers.

## Questions

### Why did my purchase pixel stop after Shopify’s checkout upgrade?
The upgraded Thank you and Order status pages don’t run Additional Scripts. Tracking moves to Customer events, where a custom pixel takes plain JavaScript, runs in a sandbox instead of on the page, and only hears about an order through analytics.subscribe('checkout_completed', …), with the order on event.data.checkout. Code pasted across as it was usually breaks on the first HTML tag or Liquid.

### Can I paste my Additional Scripts into a custom pixel?
Not as they are. Remove the script and noscript tags, replace Liquid such as checkout.order_id and total_price with event.data.checkout.order.id and event.data.checkout.totalPrice.amount, and move the tracking inside analytics.subscribe('checkout_completed', …). Code that read document.cookie or localStorage needs browser.cookie and browser.localStorage instead.

### Why does Meta count purchases twice?
Shopify’s Meta app, or your own Conversions API, already sends each purchase from the server. When your custom pixel sends Purchase too, Meta keeps one only if both carry the same ID: eventID as fbq’s fourth argument in the pixel, event_id on the server. Leave it out, or put eventID in the third argument, and Meta counts the sale twice.

### Why can’t my pixel read cookies or the page?
A custom pixel runs in a sandboxed frame, apart from your storefront, so document.cookie, localStorage, window.top and document.querySelector can’t see the store’s page. Shopify gives the pixel browser.cookie, browser.localStorage and browser.sessionStorage instead (all async), and the page’s address and title on event.context.

### Does this tool upload my code?
No. The checks run in your browser as you type, and the code is only read, never run. It isn’t sent anywhere or saved, and it never goes into the page’s address.

Use the validator (free, no sign-up; the code is only read, never run or sent): https://teraads.co/tools/shopify-pixel-validator.

---
Source page: https://teraads.co/tools/shopify-pixel-validator. Start free (no card): https://teraads.co/signup. MCP server for AI assistants: https://teraads.co/mcp.
