hello@datascale.de+49 89 921 35 623tracked cookie-free · /openDEEN

Search services, integrations and blog posts.

DatascaleResourcesShopify Custom Pixel Template

Free · a template you keep

Shopify Custom Pixel Template plus GTM Containers

The commented custom-pixel script for Shopify Web Pixels with a CONFIG block, plus import-ready web and server containers. The replacement for checkout.liquid, which stops firing on 26 August 2026.

The complete custom pixel for Shopify Web Pixels, commented and fronted by a CONFIG block, plus web and server containers as import-ready JSON. Built for stores that have to leave checkout.liquid before 26 August without losing attribution on the way out.

Why now

From 26 August 2026, checkout.liquid and the Additional Scripts field stop firing for Basic, Shopify and Advanced stores. Tracking that lives there stops working that day, with no error and no prompt. Web Pixels via customer events are the only supported route afterwards.

Moving is not enough on its own. The custom pixel runs in a sandbox, and three of its quirks cost data if you do not know about them.

What the template solves

  • The iframe URL in GA4. In the sandbox, document.location returns the iframe URL, not the shop's. The template reads event.context.window.location.
  • A fresh client_id per purchase. document.cookie throws a SecurityError in the sandbox. Without access to _ga, every purchase gets a new identity and attribution falls apart. The template reads via browser.cookie.get().
  • Lost add-to-carts. The app-generated pixel loads its code by fetch and only subscribes after the network round trip. Anything before that is gone, and with an adblocker everything is. The template subscribes synchronously.
  • Duplicate purchases. The browser event and the server event are the same event. Without a shared transaction_id, GA4 counts both. The template sets one order ID across every path.
  • Shop Pay and Express. Both lose the client_id client-side across the domain boundary. The template recovers it through cart attributes.

What you get

FileContents
custom-pixel.jsThe full script, commented, with a CONFIG block for measurement ID, server endpoint and consent groups
web-container.jsonWeb GTM container, import-ready, triggers and variables included
server-container.jsonServer container with GA4 and Meta CAPI tags plus consent mapping
qa-checklist.mdThe steps that prove it counts

How to run it

  1. Fill in the CONFIG block with your measurement ID and server endpoint.
  2. Add the script as a custom pixel under customer events in the Shopify admin.
  3. Import both containers, map the consent groups to your CMP.
  4. Place a test order in incognito. purchase with a transaction_id must arrive exactly once.
  5. After 48 hours, compare the GA4 order count against Shopify. The gap should be low single digits.

The full reasoning with every trap is in the companion article: Shopify server-side tracking with Stape.

Request the template

Enter your work email and the files arrive by mail. Soft gate, not a wall, the article stays fully readable.

Last updated:

All resources →

Asked often

What exactly happens on 26 August 2026?

For Basic, Shopify and Advanced stores, checkout.liquid and the Additional Scripts field stop firing. Tracking that hangs there fails without warning. Web Pixels via customer events are the only supported route after that. Plus stores had their own deadline, so check your plan in the Shopify admin.

Do I need Stape for this?

No. The template writes to the dataLayer and to a server container; whether that runs on Stape, Cloud Run or your own box makes no difference to it. The CONFIG block carries the endpoint URL, nothing else changes.

Why does the wrong URL land in GA4 without this template?

The custom pixel runs inside a sandbox iframe. Reading document.location there returns the iframe URL, not the page the customer sees. The template reads event.context.window.location. Cookie access has the same cause: document.cookie throws a SecurityError in the sandbox, so _ga has to come from browser.cookie.get(), otherwise every purchase gets a fresh client_id.

Does the template handle consent?

It fires consent-gated and reads state from Shopify's Customer Privacy API. The banner logic stays with your CMP. Server-side changes where tags run, not whether consent is required.

Is this legal advice?

No. The template is technical tooling. Privacy assessment belongs with qualified advisers.

Afterwards: does it actually work?

The Tracking Check tests tracking, consent and security headers live against your site.

Start the Tracking Check →

From template to setup

Documented is not measured.

Where the template exposes gaps, the measurement service wires them up, each with an acceptance criterion.