TRACKING SPECIALIST — BARIS ASA · LONDON
Synctag
Start the check → TRACKING SPECIALIST — BARIS ASA · LONDON
F-103
F-103 · COLLECTION & DUPLICATION · FILED 2026 · REVISED 24 NOV 2026 · FREQ ▮▮▮▯▯

dataLayer timing & race conditions

Also filed as “gtm tag fires before datalayer is ready”“gtm tag firing too early”“gtm datalayer race condition”“datalayer push after tag fired”“datalayer variable undefined on page view”“ga4 purchase value zero on some orders”“ga4 items array empty on some hits”

When a GTM tag fires before the dataLayer is ready, it sends its hit before the site has pushed the data the tag reads. In GA4 that shows as real orders with no value, no items or no transaction ID, so revenue runs below the shop's. The fix: push the data with an event key and fire the tag on a Custom Event trigger of that name.

Symptom and cause

Symptom
Order values there on some page loads and missing on others: GA4 purchases or product views with no items or a zero value, though the order is real. The same tag passes in testing and fails for real users.
Cause
Tags fire before the dataLayer is populated. The tag races the push, or fires on page view while the ecommerce object arrives a beat later.
Where it's caught
GA4 Explore: real orders at zero revenue, a (not set) Transaction ID row, fewer purchases than the shop's orders. GTM Preview: the tag's variables undefined on the message it fired on.

How the tag outruns the data

The dataLayer is the list a site fills with product and order details for Google Tag Manager (GTM) to read. A push is one write to it. A tag reads whatever is in that list at the moment its trigger fires. If the push has not happened yet, the variable comes back undefined and the hit goes out without it.

Google's data layer guide says GTM handles messages first in, first out, one at a time, and fires every tag whose trigger is met before it moves to the next message. A push from page code is queued behind the pending messages, and its values are not guaranteed to be available for the next event. Page View, DOM Ready and Window Loaded are messages of their own. They do not wait for the site. A tag on one of them misses order details that a template, cart call or app pushes later. If the transaction ID travels in the same push, it goes missing with the value.

It flickers because the order can change from load to load. A fast cached load fires the tag first; a slower one lets the push win. That is how it passes QA and fails in production. A push that always lands later, such as one placed below the GTM snippet with the tag on Page View, fails every time. Filed as F-103 either way. The fix is the same.

GTM fires tags on events. Give the push an event name (the event key) and a Custom Event trigger of that name fires on the very message that carries the data. Tag sequencing and firing priority do not help: they set the order of tags against each other, and nothing in them waits for the site's push.

It is not only GA4. Any tag in the container that reads the same variables on the same trigger, such as a Google Ads conversion tag sending the order value, goes out empty on the same loads.

The change itself is one push and one trigger per affected event, once the site can push the data at the right moment. Most of the work is proving it across loads.

Two related shapes. In a single-page app, History Change (GTM's trigger for a URL change without a page load) can fire before the new page has pushed its data. And GTM merges pushes rather than resetting them, so an earlier product's items can carry into a later event: wrong values rather than missing ones.

GTM Preview · one order confirmation page load · reconstructed to show the sequence, not a client account; timings illustrative
ms from startPreview messageorder detailsGA4 purchase tag
0Initializationnot pushed yetnot on this trigger
+14Container Loaded (Page View)still not pushedfires · value: undefined · items: undefined
+90purchase (the site's push)value + items presentalready sent, does not fire again
+92DOM Readyvalue + items presentonly a tag on this message reads them, this time

How to catch it

  1. Start in GA4, no GTM access needed. In Explore, open a free-form table for a closed week with Transaction ID as the dimension and Ecommerce purchases, Purchase revenue and Items purchased as the metrics.
  2. Look for three signs: real orders at zero revenue or zero items, a (not set) Transaction ID row, and fewer GA4 purchases than the shop's orders. Rule out free orders. The gap against the shop's order list for the same week is the most this fault can be costing you, not the exact cost: consent and ad blockers sit in the same gap. These signs say something is wrong, not which fault. Preview tells you which.
  3. From here it is GTM work. Open Preview, place a test order and click the message the tag fired on in the left-hand list, not Summary. Summary shows the values after every push has merged, which hides the race. In Variables, items or value reading undefined on that message is the first sign.
  4. Open the Data Layer tab on the later messages and find the push carrying items and value. If it comes after the message the tag fired on, the tag outran the data. Timing changes from load to load, so repeat on several loads, one with the cache disabled. Late on some loads is a race. Late on every load is a fixed late push. Both are F-103.
  5. Rule out the lookalikes. Values that never appear in the Data Layer tab at all are F-301: the site never sends them. A parameter present on every hit but missing from reports is F-601: never registered. A tag that fires in Preview but never for real visitors is a publishing, container, consent or URL problem, not a race. A value sent without currency can also leave revenue wrong: Google says that if you set value, currency is required for revenue metrics to be computed accurately.
  6. Optional, for the developer: read the hit itself in DevTools, Network, with Preserve log on and a filter for collect, or in GA4 DebugView with debug enabled through Tag Assistant.

What putting it right involves

  1. If you do not run GTM yourself, this is one message to your developer: the push below, plus a Preview screenshot of the tag firing before it.
  2. Developer: push the values and the event key in one object, once the data exists. On the order confirmation page, for example: dataLayer.push({ ecommerce: null }); then dataLayer.push({ event: 'purchase', ecommerce: { transaction_id: 'T1001', currency: 'GBP', value: 49.00, items: [ ... ] } }).
  3. GTM: move the GA4 event tag onto a Custom Event trigger whose event name matches that key character for character. Purchase and purchase are different names. The tag now fires on the push itself. Move any other tag that reads the same values, such as a Google Ads conversion tag, onto the same trigger.
  4. Values known when the page renders, such as page type or login status, go in a push above the GTM snippet, after window.dataLayer = window.dataLayer || [], as Google's data layer guide advises. Never re-assign window.dataLayer later in the page: Google warns it wipes what is already there. Values a cart, app or API sets later cannot be moved up. They need the two steps above.
  5. Do not cure it with a later page-load trigger, a timer, tag sequencing or firing priority. DOM Ready and Window Loaded only help if the push reliably finishes first, and a late push does not. Sequencing and priority only set the order of tags.
  6. Single-page apps: have the developer push a named event, with its values, once the new page's data is ready, and trigger on that instead of History Change.
  7. If the values are wrong rather than missing, push ecommerce: null before each ecommerce push, as every sample in Google's ecommerce guide does, so one product's items do not carry into the next event.
  8. Case closed when every tag fires on its own push, every variable resolved, on several loads in Preview, one with the cache disabled. Then a closed week in GA4: zero-value orders and the (not set) Transaction ID row should fall to near nothing. Any gap left against shop orders is consent, blockers or F-301, not this fault. Moving the trigger recovers data the site pushes. It cannot invent fields that were never sent.
How I'd fix this

Sources on file

Cited in these case files

F-103 turns up as evidence across the archive. It is cited in:

Questions on this file

Why does my GTM tag fire before the dataLayer is ready?

Because its trigger is tied to the page load, not to the data. Page View, DOM Ready and Window Loaded fire at fixed points, and the site's push lands whenever its own code finishes. Google says a push from page code is queued behind pending messages and its values are not guaranteed for the next event. Push the data with an event key and fire the tag on a Custom Event trigger of that name. The step-by-step version, with a Shopify custom pixel section, is in the note on proving and fixing it.

Does the order of dataLayer.push calls matter?

Yes. Google's data layer guide says GTM processes messages first in, first out, one at a time, and fires every tag whose trigger is met before it moves on. A tag can only read values pushed on its own message or an earlier one. So the push carrying the order details must be the message the tag fires on, which is what an event key and a Custom Event trigger give you.

How do I check whether it is happening on my store?

In GA4 Explore, list Transaction ID against Ecommerce purchases and Purchase revenue for a closed week. Real orders at zero, a (not set) Transaction ID row and fewer purchases than shop orders are the usual signs. Then confirm in GTM Preview: the push carrying items and value appears after the message the tag fired on.

Should the dataLayer go above the GTM snippet?

Yes, for values known when the page renders. Google's guide establishes the data layer before Tag Manager loads, with window.dataLayer = window.dataLayer || [], and says never to overwrite or re-assign window.dataLayer afterwards. Values a cart, app or API pushes later cannot be moved up, so those need a Custom Event trigger.

Which trigger should the GA4 tag use instead?

For an event that needs the site's data, a Custom Event trigger named after the push. Page View suits events that need only the visit, and DOM Ready tags that read the page's HTML. The note on which GTM trigger each GA4 tag needs has the full table and how to check yours in Preview.

Will DOM Ready, Window Loaded, tag sequencing or firing priority fix it?

No, though all four are often suggested. A later page-load trigger only helps if the push always finishes first, which is exactly what you cannot count on. Tag sequencing fires a setup tag before the main tag, or a cleanup tag after it. Firing priority sets which tags fire first, and Google notes they still fire asynchronously. None of them waits for the site's own push.

My tag works in Preview but not on the live site. Is that F-103?

Usually not. F-103 shows in Preview itself: the tag fires, but its variables read undefined on that message. A tag that fires cleanly in Preview and never for real visitors points to an unpublished change, a different container, a cached page, consent or a URL mismatch. The note on tags that work in Preview but not live walks through those five.

How is F-103 different from F-301 and F-601?

Look in the Data Layer tab in GTM Preview. Values that arrive on a later message than the tag's are F-103, fixed by changing the trigger. Values that never arrive are F-301, fixed in the site code. A parameter present on every hit but missing from reports or showing (not set) is F-601: it was never registered as a custom dimension.

Who fixes a GTM tag firing before the dataLayer is ready?

Two hands, often one person. A developer changes the push so the values and the event key travel together. Whoever runs GTM moves the tag onto a Custom Event trigger and tests it. What you should get back: the Preview evidence of the race, the exact push for the developer, the trigger change, and a closed week in GA4 compared with shop orders before and after. That is GTM work I take on.