Lesson 6 of 8
Testing On Checkout_completed
checkout_completed is the event that matters most and the best one to test against — it fires once when a purchase completes (usually on the Thank you page) and carries the full order. Walk it end to end.
The catch: Preview won't reach checkout
This surprises everyone. GTM Preview / Tag Assistant cannot connect to the checkout — it can't see into the pixel sandbox where your GTM and dataLayer live. So you test a different way:
- Use the Shopify Pixel Helper to confirm the events reach the sandbox without errors.
- Open DevTools Console and switch the JavaScript context (the frame dropdown) to the pixel sandbox, then inspect
window.dataLayerthere. - Place a real test order (a 100%-off discount code is the usual trick) and watch the
checkout_completedpush appear.
Read every variable from the push
When the event fires, you should see an object like this in the sandbox dataLayer. Each key is a value you'll read with a Data Layer Variable in GTM:
{
event: "checkout_completed",
orderId: "gid://shopify/Order/5123456789", // → transaction_id
currency: "USD", // → currency
value: 129.0, // totalPrice.amount → value
subtotal: 110.0, // subtotalPrice.amount
shipping: 9.0, // shippingLine.price.amount → shipping
tax: 10.0, // totalTax.amount → tax
client_id: "abc123...", // Shopify clientId
token: "a1b2c3...", // unique checkout token
timestamp: "2026-06-06T14:05:00Z"
}Wire it up in GTM
- Variables: a Data Layer Variable for each key —
orderId,currency,value,shipping,tax, and your reshapeditems. - Trigger: a Custom Event trigger with event name
checkout_completed— it must match theeventkey in the pixel exactly. - Tag: a GA4 Event tag named
purchase, mappingtransaction_id,value,currency,shipping,taxanditemsto those variables. - Verify: confirm each parameter shows the real order value, and that it fires once.
Key takeaway
Test checkout_completed with a real test order, not Preview — Preview can't see the sandbox. Use Pixel Helper and the console (switched to the sandbox frame), then build one DLV per field, a Custom Event trigger named exactly checkout_completed, and a GA4 purchase tag.