Analytics Instrumentation · Schkovl's own site
schkovl.com: a month of consent-gated analytics that recorded nothing
Google Analytics 4 went live behind a consent banner on 2026-08-26 and recorded nothing for a month, even for visitors who accepted. The site's gtag stub queued plain arrays; gtag.js reads only Arguments objects, so every queued command was ignored. The cause was two lines; the fix changed five and added a regression test.
- Requests · Sep 24, 2026
- 0
- GA4 collect requests after a visitor accepted analytics (headless reproduction)
- Event types · Sep 26, 2026
- 3
- GA4 Realtime event types recorded for the first consented test visit: first_visit, session_start, page_view
- Change
- 5 lines
- Lines changed in one source file (3 added, 2 removed), plus a regression test
The finding
We installed GA4 on schkovl.com on 2026-08-26 behind a Consent Mode v2 banner: nothing loads until a visitor clicks Accept. For the next month the property showed "No data received". By 2026-09-10 we had ruled out a Content Security Policy block, then wrongly attributed the missing requests to the test browser's own extensions. A code audit on 2026-09-24 found the cause: the site's gtag stub pushed a plain array onto the dataLayer. gtag.js reads only Arguments objects from that queue, so every consent, config and page_view command was ignored — even after Accept.
The fix
The stub now pushes its Arguments object instead of a rest-parameter array: three lines added, two removed, in one file. A regression test asserts that each queued entry is an Arguments object, so the same mistake fails the test suite if it comes back.
The verification
Before the fix, a headless reproduction on 2026-09-24 sent zero /g/collect requests after accepting analytics. After the fix deployed on 2026-09-26, the queued dataLayer entries read [object Arguments], a page_view request went to /g/collect, and GA4 Realtime recorded first_visit, session_start and page_view for the test visit. On 2026-10-01 a fresh browser session sent no collect request before consent and two after clicking Accept.
Why we publish our own mistakes
A month with no data is exactly the kind of gap the Gap Analysis exists to find. The defect was invisible from the dashboard, survived a plausible wrong explanation, and fell to a code read that checked what the browser actually queued.