Web Analytics
Magento Analytics

Purchases dropped before the page knew the customer had consented

The tracking was installed and the cookie banner worked. The purchase event just fired before the page had told Google whether the customer had said yes, so returning customers were counted as unknown for the first moment of the page. We set the consent state before the tag manager loads and read the saved answer straight away.

Situation

Orders were coming in. The reports showed a fraction of them.

The store owner’s Google Ads numbers looked wrong. Orders were arriving in Magento, but the analytics and ad reports showed far fewer purchases than the order grid did.

Nothing was broken in the obvious sense. The tracking code was installed, the cookie banner worked, and the purchase event fired on the order confirmation page. On the day we measured, 3 of 11 orders were recorded.

What we found

The order things loaded in

Google’s consent mode needs to know, before any tag fires, whether the visitor has allowed analytics and advertising cookies. On this store the consent state was set by the banner after the tag manager had already loaded. For a new visitor that is fine: they see the banner, answer it, and the page carries on.

A returning customer who had already said yes was different. For the first moment of the page they were treated as “unknown”, and the confirmation page is exactly where the purchase is recorded in that first moment. Google dropped it. The customers most likely to buy were the ones least likely to be counted.

What we did

Consent first, then the tags

  • Default consent state before the tag manager The page now declares the default consent state at the very top, before the tag manager script, as Google’s consent mode expects.
  • Saved answers read immediately A returning customer’s stored choice is read and applied in the same moment, so a purchase on the confirmation page is recorded with the right permissions.
  • Ad click ids kept while consent is denied A week later we found a second leak: a visitor who clicked an ad and accepted cookies on their second or third page lost the click id along the way. It is now carried through internal links until consent is given.

Both changes were tested on our own copy of the store with real consent choices before they went live.

Result

Purchases counted for every customer who allowed it

3 of 11orders tracked before the fix, on the day measured

2releases, one week apart

Purchases from consenting customers now reach Google Analytics and Google Ads, which means the figures the owner uses to decide ad spend are the store’s own figures.

Worth checking on your store

Compare the reports with the order grid

  • Pick one recent day and count the orders in your admin. Then count the purchases in GA4 for the same day.
  • If the gap is bigger than the share of visitors who decline cookies, something is being dropped.
  • Check where the consent default is set. If it is after the tag manager loads, you have this problem.