Skip to content

fix: fix Google Analytics gtag - #51

Merged
sburton84 merged 1 commit into
mainfrom
analytics-fix
Jul 28, 2026
Merged

fix: fix Google Analytics gtag#51
sburton84 merged 1 commit into
mainfrom
analytics-fix

Conversation

@sburton84

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the window.gtag shim so it records commands into dataLayer in the same shape as Google Analytics’ recommended snippet (pushing a real arguments object), which is required for gtag.js to correctly process commands like config and consent.

Changes:

  • Update ensureGtag() to implement gtag as a normal function and push the genuine arguments object to dataLayer.
  • Adjust tests/helpers to normalize dataLayer entries (including Arguments) into plain arrays for assertions.
  • Add a test assertion verifying the dataLayer entry is [object Arguments].

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
documentation-ui/src/custom/docs/components/analytics/consent-mode.ts Switches gtag shim to push a real arguments object so GA command processing works correctly.
documentation-ui/src/custom/docs/components/analytics/consent-mode.test.ts Updates assertions/helpers to handle Arguments entries and verifies the correct entry type is recorded.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sburton84
sburton84 merged commit ada7ee0 into main Jul 28, 2026
5 checks passed
@sburton84
sburton84 deleted the analytics-fix branch July 28, 2026 16:12
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.

2 participants