Skip to content

Best Practices for Shopify Plus Data Layer

A Shopify Plus data layer now has two halves: theme pushes to window.dataLayer for storefront pages, and Customer Events pixels for checkout and purchases. This guide covers which tool sends which event, the GA4 ecommerce schema, naming, consent, testing and upkeep.

Best Practices for Shopify Plus Data Layer

The best practice for a Shopify Plus data layer today is to split it in two: push storefront data (pages, products, cart) to window.dataLayer from your theme, and capture checkout and purchase events through Shopify's Customer Events API in a custom pixel or a web pixel app extension. Use GA4 ecommerce event names in both places, respect the visitor's consent, and test every event before you publish it.

Below: what changed, which tool sends which event, schema and naming rules, consent, testing and upkeep. For step-by-step code, see our guide on how to add a data layer to Shopify Plus.

What is a data layer on Shopify Plus?

A data layer is a JavaScript array, usually window.dataLayer, that your store fills with structured facts: what kind of page this is, which product is shown, what was added to the cart and what was bought. Google Tag Manager (GTM) reads those pushes and passes the values to GA4, Google Ads, Meta and other tools, so every tool works from the same numbers.

Shopify does not create a GTM data layer for you. It does publish its own stream of customer events, such as product_viewed and checkout_completed, which Shopify calls a "Shopify data layer or event bus" that pixels subscribe to. A good setup uses both: your own dataLayer where the theme runs, and Shopify's events where it does not.

What changed since the Additional Scripts era?

Older guides, including the first version of this post, said to paste GTM into the checkout's Additional scripts box and build Universal Analytics "Enhanced Ecommerce" objects. That no longer works.

Old approachStatusUse instead
GTM and purchase code in Additional scripts or checkout.liquidSunset on the Thank you and Order status pages on 28 August 2025 (Shopify). Stores not upgraded by 26 August 2026 were upgraded automatically (Shopify Help Center).A custom pixel or web pixel app extension under Settings > Customer events
Universal Analytics and Enhanced Ecommerce (ecommerce.detail, actionField)Universal Analytics stopped processing new data on 1 July 2023 (Shopify Help Center)GA4 ecommerce events with an items array
Tracking code injected by apps through script tagsApps cannot create or update script tags since 1 October 2026, and script tags stop running on storefronts on 1 March 2027 (Shopify changelog)App embed blocks for storefront code, web pixels for tracking

The wider checkout changes are covered in our post on Shopify Checkout Extensibility in 2026.

Which tool should handle which event?

Most Shopify Plus stores combine two to four of the tools below. The rule that keeps the data clean: each event goes to each destination from exactly one place.

ToolWhere it runsBest forLimits
Shopify's Google & YouTube appStorefront and checkoutGA4 and Google Ads basics without code. It sends page_view, view_item, add_to_cart, purchase and more, mapped from Shopify's standard events (Google).Fixed events and parameters
Theme dataLayer with GTMOnline store pagesPage context, product data, custom storefront events, click and scroll triggersDoes not run in checkout
Custom pixelStorefront, checkout, Thank you and Order status pages (Shopify Help Center), inside a sandboxCheckout steps and purchases for GTM, Meta and other toolsNo access to the page DOM, a sandbox URL, and Shopify does not support the code you write
Web pixel app extensionThe same pages, in a stricter sandboxVersioned tracking code shipped in a custom app, with settings per storeNeeds an app and a developer

If the Google & YouTube app already sends GA4 events to a property, do not send the same events to that property from GTM, or every purchase is counted twice. Either let the app own GA4 and use GTM for the other destinations, or disconnect GA4 in the app and send it from GTM.

Which event names and fields should you use?

Use Google's GA4 ecommerce events as the single schema, even for tools other than GA4. GTM can map them for Meta or anyone else, and one schema is far easier to test.

GA4 eventSent fromMatching Shopify standard event
view_item_listTheme: collection and search pagescollection_viewed
view_itemTheme: product sectionproduct_viewed
add_to_cartTheme: cart JavaScriptproduct_added_to_cart
view_cartTheme: cart page or drawercart_viewed
begin_checkoutPixelcheckout_started
add_shipping_infoPixelcheckout_shipping_info_submitted
add_payment_infoPixelpayment_info_submitted
purchasePixelcheckout_completed

The full list of Shopify events is in the standard events reference. Five rules prevent most reporting errors:

  • One item ID rule. Decide whether item_id is the SKU or the variant ID and use the same rule in the theme and the pixel. Google requires item_id or item_name on every item and recommends sending both.
  • Numbers, not formatted prices. Liquid returns prices in the currency's subunit, such as cents (Shopify), so divide by 100. Money filters return formatted text, which breaks revenue reports.
  • Currency with every value. Google asks you to set currency at event level whenever you send value.
  • Clear the ecommerce object. Push { ecommerce: null } before each ecommerce event, as Google's own examples do, so items from one event do not leak into the next.
  • One definition of value. Decide whether value includes tax and shipping and write it down. For comparison, the Google & YouTube app has calculated begin_checkout and purchase value as subtotal minus discounts since 24 April 2025 (Google).

How should you name events and variables?

  • Keep GA4's lowercase names for standard events. Do not invent variants such as productView or addToCart.
  • Prefix your own events, for example store:size_guide_opened. Shopify asks for a prefix on custom events published with Shopify.analytics.publish to avoid collisions (Shopify), and the same habit keeps GTM triggers readable.
  • Name GTM variables after their data layer path, such as DLV - ecommerce.value, so anyone can see where a value comes from.
  • Never push personal data. Google's policy forbids sending anything Google could recognise as personally identifiable, such as email addresses or phone numbers (Google). Push a logged-in flag, not the customer's email.

Set up Shopify's customer privacy settings and cookie banner first, then connect both halves of the data layer to the same consent signal.

  • Pixels: every custom pixel has Permission and Data sale settings. In regions that require consent, such as the EEA and UK, a pixel runs only when the visitor has given the permissions it requires (Shopify Help Center). Inside the pixel, init.customerPrivacy gives the starting status and visitorConsentCollected reports changes (Shopify).
  • Theme: GTM in theme.liquid is not gated by Shopify. Read the visitor's choice with the Customer Privacy API, using analyticsProcessingAllowed(), marketingAllowed() and the visitorConsentCollected event, and pass it on to GTM.
  • Google consent mode: send a default command for ad_storage, analytics_storage, ad_user_data and ad_personalization before any tag fires, then an update when the visitor decides. Google warns that defaults do not work if the consent code runs out of order (Google).

A common mapping: analytics consent to analytics_storage, marketing consent to the three advertising signals. Confirm it with whoever handles privacy for you, since Shopify notes that its example consent settings might not fit every store.

How do you test a split data layer?

  • Storefront: GTM Preview mode shows each theme push, variable and tag as it happens.
  • Checkout: Google Tag Assistant's Troubleshoot tag feature does not detect Google tags inside a custom pixel, so Shopify recommends its Pixel Helper (Shopify Help Center). Check the results in GA4 DebugView as well.
  • Purchases: checkout_completed fires once per checkout, usually on the Thank you page, or on the first upsell page if you use post-purchase offers (Shopify). Place test orders through both paths.
  • Reconciliation: compare GA4 purchases with Shopify orders for the same days. GA4 is usually lower because of consent and blockers. A sudden change in that gap means something broke.

How do you keep the data layer healthy?

  • Keep a tracking plan with one row per event: trigger, source (theme or pixel), destinations and owner.
  • Re-test after theme updates, new apps and checkout changes, since a theme update can silently drop a snippet.
  • Review Settings > Customer events for pixels that overlap, for example a Meta app pixel plus a Meta tag in GTM.
  • Find apps that still depend on script tags and replace them before 1 March 2027.

Shopify Plus adds one more option: checkout UI extensions on the information, shipping and payment steps are available only on Plus (Shopify), and they can publish custom events with analytics.publish, for example when a buyer opens a gift note field. We set up and audit this kind of tracking as part of our Shopify Plus checkout customization work.

FAQ

Does Shopify Plus have a built-in data layer?

Not one that GTM reads. Shopify publishes standard customer events that pixels can subscribe to, and the Google & YouTube app turns them into GA4 and Google Ads events. For a window.dataLayer on the storefront, you add the pushes to your theme yourself.

Can I still put GTM in Additional scripts?

No. Additional scripts and checkout.liquid were sunset on the Thank you and Order status pages on 28 August 2025, and the remaining stores were upgraded automatically in August 2026. Checkout and purchase tracking now runs through pixels in Settings > Customer events.

Is Enhanced Ecommerce still used?

No. Enhanced Ecommerce belonged to Universal Analytics, which stopped processing data in July 2023. Use GA4 ecommerce events such as view_item, add_to_cart, begin_checkout and purchase, each with an items array.

Do I need GTM if I use the Google & YouTube app?

Not for standard GA4 and Google Ads tracking. GTM is worth adding when you need other destinations, custom events or your own parameters. Just make sure the app and GTM never send the same event to the same GA4 property.

Scaling on Shopify Plus?

Migration, B2B, architecture, performance — we run the engagements other agencies hand back.

The checklist we run before touching a client's code

Get it by email, plus a few short notes over the next two weeks: what we see most often on Shopify stores and what actually fixes it.

No spam. Unsubscribe anytime. Privacy Policy

Want more of our posts in your Google results? Add Codersy as a preferred source.

Add Codersy on Google(opens in a new tab)