Field notes ·
Your tracking passed every check. It's still broken.
Tag Assistant is green and the numbers are still wrong. Why tracking needs a test suite, the assertions worth writing first, and how AI makes them practical.
Every tracking setup gets the same send-off. Someone opens Tag Assistant, clicks through a purchase, watches the tags go green in GTM preview, and publishes. A month later the client asks why most of their revenue is sitting in Direct.
Nothing was wrong with the check. It was just the only check, and it covered one path out of more than a hundred.
Software teams solved this years ago. Code goes through unit tests, integration tests, a staging environment and a review before it reaches production, and a bad release can be rolled back in minutes. Tracking skips almost all of that. We build it, click through a couple of journeys, publish, and find out it’s broken when the client’s numbers stop making sense.
This post was sparked by Shubham Sharma’s talk at MeasureSummit 2026 on using AI and MCP servers to audit and test tracking. His argument is simple: tracking has never had a test suite, and it can now have one. We agree, and we went a step further. More on that at the end.
The maths of a manual check
Take a fairly ordinary ecommerce site and count the ways a customer can reach a purchase:
That’s 6 × 3 × 2 × 4 = 144 paths, before you add a second payment method, a logged-in state or a cross-domain checkout.
A careful person testing by hand covers five, maybe ten. Almost always it’s “accept all, arrive direct, buy something”, which is the one path least likely to be broken. Consent states and paid entry points, where tracking usually fails, are the ones nobody has time to click through.
What breaks in the paths nobody clicks
The problems that survive a manual check share one trait: every tag fires, so every check looks green. The failures sit in the gaps between tools. A few classes worth knowing:
The consent tool that wipes the session. Some cookie banners clear cookies on page load in certain configurations. If that happens on the return from a payment gateway, the GA4 client and session cookies are gone by the time the thank-you page loads. The purchase is tracked, but in a brand-new session with no source, so GA4 files it under Direct. Tag Assistant shows a perfect purchase event.
Events that race the consent default. Consent Mode depends on a default being set before any Google tag fires. If an event wins that race on a slow connection or a heavy page, it goes out before the consent state and configuration are in place. Sessions split, identifiers change mid-journey, and you see a slice of unassigned traffic that no setting seems to explain. It happens on some page loads and not others, which is why a few manual runs never catch it.
A tag that loads but never sends. A custom tag can be in the container, fire on the right trigger, and still produce zero network requests, because the site’s Content Security Policy blocks the domain it calls. The script is there. The request isn’t. Only the network tab, or the platform receiving no data, tells you.
The purchase that fires twice. The customer buys, then opens the confirmation email a day later on their phone and lands back on the thank-you page. If the data layer pushes purchase on every load of that page, the platforms count a second purchase. GA4 only deduplicates a repeated transaction_id from the same user, and a phone that has never visited before is a new user. Meta only deduplicates events that share an event_name and event_id and arrive within 48 hours of each other, and a re-fired purchase usually gets a fresh ID anyway. No one tests “reopen the email tomorrow on another device”.
Shubham walked through real incidents along these lines in his talk. They’re also the kind of fault that turns into the client conversations agencies dread: “why doesn’t Meta match Shopify”, “why is Direct so high”, “why did ROAS drop when nothing changed”.
Write assertions, not checklists
The shift is from “did it look OK?” to “did these statements hold on every path?”. An assertion is a rule that’s either true or false for each run. These are the ones we’d write first:
- It fired. Every expected event sent a network request, not just a tag-fired entry in preview.
- It fired once. One purchase per order, one
generate_leadper submitted form. No duplicates on reload, back-button or revisit. - The required parameters are present and not empty. For a purchase:
transaction_id,value,currencyanditems. An empty string passes a “parameter exists” check and does real damage: GA4 treats every purchase withtransaction_id=""as a duplicate of the others. - The value matches the order. The
valuesent equals what the order confirmation shows, with tax and shipping handled the way the client reports revenue. - Consent signals match the state you set. If the test rejected cookies, the requests must say so. In GA4 and Google Ads hits,
gcscarries thead_storageandanalytics_storagestate (G100is both denied,G111both granted), andgcdencodes all four Consent Mode V2 signals plus whether each came from a default or an update. - Identity holds across the journey. The GA4 client ID and session ID are the same on the thank-you page as on the landing page, including after a payment-gateway redirect. If they change, attribution breaks right there.
- Nothing fires that shouldn’t. No
purchaseonbegin_checkout, no marketing tags before consent on a reject path, no test events on production. - The server sent what the browser sent. If there’s a server container, the outgoing requests to GA4, Meta and Google Ads carry the same event, value and IDs, and the browser and server Meta events share an
event_id.
Notice what’s missing: “the tag is green in preview”. That’s an input, not a result.
The browser is only half the witness
Most testing stops at the browser. With server-side tracking that’s half the story. A server container can drop an event, rewrite a parameter, fail a consent check, or time out on its way to Meta, and the browser will never know.
So a proper test reads both sides:
- Browser side: what the page pushed to the data layer and what requests left the browser.
- Server side: what arrived at the tagging server, and what it forwarded to each platform. Most server-side GTM hosts let you export incoming and outgoing request logs for a time window, and those logs are where assertions 2, 7 and 8 get settled.
Then check the platform itself after a fix ships. If GA4 still shows the problem a day later, the fix didn’t work, whatever preview said.
Where AI makes this practical
None of this is new as an idea. What’s new is that it no longer takes a week of an engineer’s time per client.
With MCP servers, an AI agent such as Claude can connect directly to the tools involved:
- a browser it can drive through real journeys, clicks, forms and consent choices, while reading the network requests
- the GTM API, to read what the container is set up to do on both the web and server side (Stape publishes a GTM MCP server, and there are several others)
- the GA4 Data API, to confirm a fix shows up in the data
- server logs, to check what actually left the tagging server
Give it the journeys and the assertions, point it at staging before you publish, and it returns pass or fail per assertion with the request that proves it. Shubham’s live demo ran against a staging site with errors planted on purpose, and the run reported which assertion failed and why.
It also handles the job everyone avoids: finding which of 40 container versions broke something. Comparing five versions by hand, client and server, can take a couple of working days. An agent can step through version previews, run the same assertions against each, and tell you where the break first appears.
Where it falls over
Honest limits, because they matter when you sell this to a client:
- Real payments. Don’t let an agent anywhere near live payment details. Use the gateway’s test mode on staging.
- Bot protection and SSO. Aggressive bot detection and single sign-on will block an automated browser, by design.
- Pages that change between runs. A/B tests and personalisation mean two runs of the same journey can see different pages. Expect some flaky results until you pin variants.
- It checks what you asked it to check. If your assertion is wrong, it will confirm the wrong thing with total confidence. It can’t tell you that your expectation was wrong. That judgement stays with whoever owns the measurement plan.
This is a skill you build, not a button you press.
What to do this week
- Pick one journey: paid click (with a gclid), reject consent, purchase. It’s the one most likely to be broken.
- Write three assertions for it: fired once, value matches the order, consent state matches.
- Run it against staging before your next publish, not after.
- Every time something breaks in production, add one assertion that would have caught it. In a few months you’ll have a test suite shaped like your own clients’ failures.
- Keep the run logs. When a client asks what changed, you’ll have an audit trail instead of a guess.
We got a bit obsessed
We spend our days inside other people’s tracking, and the same failures kept coming back: duplicate pixels, purchase events with no event_id, Consent Mode defaults set after the tags, server containers nobody was watching. We got so obsessed with catching them early that we built our own tools to help agencies do it.
The first is the Signal Stress Test on Measurement.here. It starts with what the container is configured to do. You give us read-only access to a client’s Google Tag Manager, and our AI and engineers map the whole container. You get a Tracking Health Score and a prioritised list of what’s broken: duplicate pixels, missing deduplication keys, Conversions API gaps, data layer drops and missing Consent Mode V2 setup. Nothing in the live setup is touched, the report comes back within 24 business hours, and it’s free for up to two of your client accounts.
If you’d rather have the full journey-and-server test suite built and run for your clients, that’s what our AI in measurement work does. Book a call and we’ll show you what it finds.
Sources
- Google: consent mode concepts, including the gcs and gcd request parameters
- Google: implement consent mode with server-side Tag Manager
- Stape: how the gcd parameter encodes Consent Mode V2 states
- Google: minimise duplicate key events with transaction IDs
- Meta: handling duplicate Pixel and Conversions API events
- Shubham Sharma (Velstar), “Use AI and MCP servers to audit and test your tracking in minutes”, MeasureSummit, October 2026