Shopify's built-in GA4 integration works for the basics but falls apart for serious tracking. Here's the GTM-based approach we use on every Shopify Plus client.
Why not use Shopify's native integration
It works for view_item and purchase events but misses begin_checkout, add_payment_info, and custom events. It also doesn't expose the dataLayer for extension. For anyone running ads, you outgrow it within a month.
Step 1: Install GTM in theme.liquid
Add the GTM head + body snippets to layout/theme.liquid. Use the official Shopify GTM extension if available, otherwise inline.
Step 2: Listen for Shopify's customer events
Shopify exposes events via web pixel extension API. Listen for product_viewed, product_added_to_cart, checkout_started, payment_info_submitted, and checkout_completed.
Step 3: Push to dataLayer
For each event, push a GA4-shaped event to dataLayer. Map Shopify's product object to GA4 ecommerce items array.
Step 4: Configure GA4 tags in GTM
Create one GA4 event tag per dataLayer event. Reference the ecommerce object via Built-in Variables > Page > Event.
Step 5: Verify with DebugView
Open GA4 → DebugView. Make a test purchase. You should see the full sequence: view_item → add_to_cart → begin_checkout → add_payment_info → purchase, each with proper item-level data.