Shopify Web Pixels vs GTM: Which Should You Use for Tracking?

Shopify's Web Pixel API and Google Tag Manager solve the same problem differently. Here's when to use each, what each can't do, and the hybrid approach that covers everything.

ShopifyWeb PixelsGTMGoogle Tag Managertrackingecommerce

Shopify gives you two paths for tracking: their native Web Pixel API (introduced with checkout extensibility) and the classic Google Tag Manager approach. They’re not interchangeable — each has access to different events, different pages, and different data.

Here’s the honest comparison.

What Each One Actually Is

Shopify Web Pixels

A JavaScript sandbox that runs inside Shopify’s Web Worker. You write tracking code that subscribes to Shopify’s standardized events (product_viewed, checkout_completed, etc.). The code runs in isolation — no DOM access, no cookie reading via document.cookie, limited API surface.

Key constraint: Web Pixels run in a sandbox. They can’t inject scripts into the page, modify the DOM, or read arbitrary cookies. They can only access what Shopify’s API exposes.

Google Tag Manager

A container that loads on every page and fires tags based on triggers you configure. Full access to the DOM, cookies, data layer, and any JavaScript you want to run.

Key constraint on Shopify: GTM can’t run on checkout pages (Shopify locks them down). So your most critical conversion event (purchase) is invisible to GTM unless you use workarounds.

The Comparison

CapabilityWeb PixelsGTM
Checkout page accessYes (native)No (blocked by Shopify)
Purchase eventYesOnly via thank-you page scripts or webhooks
Product page eventsYesYes
Add to cartYesYes (with data layer)
Custom JavaScriptLimited (sandbox)Unlimited
Cookie accessLimited (_shopify_y, click IDs)Full (document.cookie)
DOM manipulationNoYes
Third-party scriptsNo (can’t inject)Yes
Server-side eventsVia POST to your serverVia sGTM or data layer
Consent managementShopify’s consent APIFull CMP integration
Platform supportAny (you write the code)Any (via tags)
DebuggingLimited (no preview mode)GTM Preview Mode

When to Use Web Pixels Only

  • Simple tracking needs: GA4 + Meta Pixel + 1-2 other platforms
  • Shopify Plus not available: Standard Shopify plans restrict checkout customization
  • You want Shopify to manage updates: Pixel API updates when Shopify updates events
  • Shop Pay tracking is critical: Web Pixels fire during Shop Pay checkout flows that GTM misses entirely

When to Use GTM Only

  • Complex tag management: 10+ tags with conditional logic, sequencing, and variables
  • Non-Shopify pages in the flow: Blog, landing pages, or microsites on different platforms
  • Advanced remarketing: Custom audience building, scroll tracking, video tracking
  • Heatmaps and session recording: Tools like Hotjar, FullStory, or Clarity need DOM access

The GTM-only problem: You miss checkout events. The purchase event won’t fire unless you add tracking to the thank-you page via Shopify’s “Additional scripts” field or use server-side webhooks.

Use both. Let each do what it’s best at:

Web Pixels:
  → Checkout events (begin_checkout, add_payment_info, purchase)
  → Shop Pay purchase recovery
  → Server-side CAPI dispatch

GTM:
  → Pre-checkout events (page_view, product views, add to cart)
  → Custom events and advanced tracking
  → CMP integration
  → Third-party tools (heatmaps, chat, etc.)

Deduplication: Both systems fire events with the same event_id format (using the checkout token). Platforms like GA4 and Meta deduplicate by event_id, so you don’t get double-counted conversions.

How to Set Up the Hybrid

Step 1: Install GTM on your Shopify theme (via theme.liquid or Shopify’s Custom Pixels for non-checkout pages)

Step 2: Deploy a Web Pixel for checkout tracking (via Shopify Admin → Settings → Customer events)

Step 3: Ensure event IDs are consistent between GTM data layer pushes and Web Pixel event dispatches

Step 4: Test with GTM Preview Mode for GTM tags and browser DevTools Network tab for Web Pixel events

Server-Side: The Common Ground

Both approaches benefit from server-side tracking:

  • Web Pixels + server-side: Pixel sends events to your server → server dispatches to Meta CAPI, GA4 Measurement Protocol, etc.
  • GTM + server-side GTM: Client-side GTM sends to sGTM container → sGTM dispatches to platforms

The end result is the same: server-side events that bypass ad blockers and iOS restrictions. The architecture is different but the outcome is identical.

Migration Path

If you’re currently on GTM and considering Web Pixels:

  1. Don’t rip out GTM. Add Web Pixels alongside it.
  2. Move checkout tracking to Web Pixels (this is the biggest win — you gain checkout visibility)
  3. Keep GTM for everything else (pre-checkout events, custom tracking, third-party tools)
  4. Test dedup before going live — complete a test purchase and verify you see exactly ONE purchase event in each platform

If you’re starting from scratch, the hybrid approach is the way to go. Need help setting it up? Run a free tracking scan first to see what you currently have.