Skip to content

fix: push Arguments objects to dataLayer so gtag.js processes commands - #64

Merged
Aliferous3 merged 1 commit into
mainfrom
fix/ga4-datalayer-arguments
Sep 29, 2026
Merged

Aliferous3 merged 1 commit into
mainfrom
fix/ga4-datalayer-arguments

Conversation

@Aliferous3

Copy link
Copy Markdown
Owner

Summary

  • The dataLayer shim pushed (...args) => push(args) — plain Arrays. gtag.js's command interpreter only processes Arguments objects, so every queued command (config, page_view, events) was silently ignored: the container registered but no collect hit ever flushed and _ga was never written.
  • Verified by a controlled A/B on a bare page: arguments-push → g/collect fires and _ga is set; array-push → nothing.
  • Adds a source-level regression guard.

Test plan

  • Local A/B reproduction confirms fix flushes hits
  • npm test 476 pass / 0 fail, typecheck clean
  • Production re-verification of /g/collect after deploy

Generated with Devin

The gtag.js command interpreter only recognizes dataLayer entries that
are Arguments objects — the official snippet's dataLayer.push(arguments).
The rest-args shim pushed plain Arrays, which were silently ignored: the
container registered but no hit ever flushed (no collect request, no _ga
cookie). Verified by A/B on a bare page — arguments-push flushes hits,
array-push never does.

Adds a source guard so the shim can't regress.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
dev-ledger Ready Ready Preview Sep 29, 2026 10:29pm UTC

@Aliferous3
Aliferous3 merged commit 1b6b8d9 into main Sep 29, 2026
5 checks passed
@Aliferous3
Aliferous3 deleted the fix/ga4-datalayer-arguments branch September 29, 2026 22:30

This branch was successfully deployed

1 active deployment
Preview — 86974a6d Deployed Sep 29, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant