Why does my GTM Enhanced Ecommerce purchase tag never fire on the order confirmation page?
The tag almost always fails because the ecommerce object with transaction data is not actually present in dataLayer by the time the trigger evaluates - commonly because the confirmation page is reached via a redirect from the payment processor that drops needed data, or a page cache is serving a static confirmation page that never runs the code that would push it.
Why this happens
Order confirmation pages are structurally different from the rest of a site's pages: they are often reached via a redirect back from an external payment gateway, they may be served through a CDN or full-page cache that does not execute per-request logic, and the transaction data has to come from somewhere - a server-rendered template, an API call, or a value passed through the redirect URL. Any break in that chain means the ecommerce object your purchase tag's variables expect simply is not there, so the trigger either never fires or fires with empty transaction values.
Fix it
- Load the confirmation page directly after a real test purchase and check
window.dataLayerin the console for an ecommerce object with purchase event data - if it is missing entirely, the problem is upstream of GTM, not a trigger misconfiguration. - If the page is served from a CDN or cache, confirm the confirmation URL is excluded from caching or that transaction data is rendered per-request rather than baked into a cached template.
- Check whether the payment gateway's redirect back preserves the order or session identifier your page needs to look up transaction details.
- Push the ecommerce object as its own custom event before or as part of the tag's trigger:
dataLayer.push({event:"purchase", ecommerce:{transaction_id:"...", value: 129.00, items:[...]}}), and trigger the tag on that purchase custom event, not on DOM Ready. - Add a fallback for users who reach the confirmation page via back-button navigation or a refresh - store a flag confirming the purchase event has already been sent for this order ID, and skip the push if it has, to avoid double-counting.
How to verify it worked
Complete a real end-to-end test transaction, and in GTM Preview confirm both that the purchase event appears in the Data Layer tab with populated transaction values, and that the GA4/Ads purchase tags fired with those values passed through in the Variables tab. Check GA4 DebugView for a purchase event carrying the matching transaction_id, and confirm reloading the same confirmation page does not produce a second purchase event in Preview.
Still stuck after working through this?
Send us what you are seeing in Preview and the Network tab. We trace GTM containers for a living and can usually tell you what is actually happening in one look.
Ask a GTM Engineer