Install a visitor ID tag on Shopify: custom pixel limits

Shopify's supported place for third-party tracking code you add yourself is a custom pixel, under Settings > Customer events. A custom pixel is not a normal page script. It runs in a sandbox and accepts only JavaScript, with no HTML, so you cannot paste a <script src=...> tag into it; you have to rewrite it as the equivalent JavaScript. It learns about the store through Shopify's standard events such as page_viewed, not by reading the page.

So before you install, ask your vendor one question: does its tag support Shopify custom pixels, or does it offer a Shopify app? A tag written for an ordinary web page may load in the sandbox and still not record what you expect. Shopify's own docs say "not all pixel functionality works in the sandbox".

How do you add the tag as a custom pixel?

Where it goes: Settings > Customer events. Give the pixel a name and click Add pixel to open the event editor, then paste the JavaScript version of the vendor's code into the Code window.

  1. Remove every HTML tag from the vendor's snippet. Replace <script src="..."> with JavaScript that creates the script element and sets its src. Shopify's help page covers exactly this change.
  2. Record page views by subscribing to the page_viewed standard event with analytics.subscribe(), and pass the page address from the event's context to the vendor's page call. Your vendor's docs should say which call to use.
  3. Set the pixel's Customer privacy options (see below), click Save, then Connect pixel.

What breaks a custom pixel

  • Custom pixels load in a lax sandbox. Code that expects to read the storefront page directly may not work.
  • By default a new custom pixel requires Marketing and Analytics permission. In regions where Shopify asks visitors for consent, it will not run until they agree. It is also classed as data sale, so it does not run for customers who opted out of data sale or sharing, unless it supports limited data use. Change these settings only with your privacy owner.
  • Custom pixels also run on checkout and post-purchase pages, which is useful. Consider whether your sales team needs those events at all.

How to check the custom pixel

Open the storefront in a private window, accept cookies, and view two products and a collection. The vendor's requests should show each page. Then repeat with cookies declined, and confirm the pixel stays silent if that is what your privacy owner chose.

Sources: Shopify Help: Creating custom pixel code (read 2026-09-25); Shopify Help: Custom pixels (read 2026-09-25); Shopify Help: Managing custom pixels (read 2026-09-25); Shopify Dev: Web Pixels API (read 2026-09-25).

When is a vendor's Shopify app the better route?

Where it goes: If your vendor publishes a Shopify app, check whether it adds an app pixel. Shopify loads app pixels in a strict sandbox, tighter than the lax sandbox custom pixels use, and the app, not you, maintains the code. Ask the vendor which route it supports before you choose.

What to check before you use an app

  • Check what data the app asks for when you install it. An app that wants order and customer data is asking for more than page visits, and that is a question for your privacy owner.
  • Do not run the app and a custom pixel for the same vendor at once, or every page is counted twice.

How to check an app install

Check the vendor's dashboard for your own test visit, then disconnect any older pixel or theme-code copy of the same tag.

Source: Shopify Dev: Web Pixels API (read 2026-09-25).

Where to go next