Skip to content

public: flag Google tags gone from or new on a home page - #36

Merged
oxyc merged 1 commit into
mainfrom
feat/tag-drift
Dec 2, 2026
Merged

oxyc merged 1 commit into
mainfrom
feat/tag-drift

Conversation

@oxyc

@oxyc oxyc commented Dec 2, 2026

Copy link
Copy Markdown
Member

Tracking breaks silently: a deploy drops the GTM snippet, a consent-tool update stops printing it, someone swaps the container. This adds a check against the IDs each site should have.

What it does

  • Prober (web): records the Google tag IDs each home page names, as PublicSite.Tags. It reads the page it already fetches, so no extra requests.
    • GTM-… anywhere in the page. A consent tool's parked text/plain copy and the noscript fallback count: the tag is still the site's, consent or not.
    • G-… only where gtag loads (?id=G-…) or configures ('config', 'G-…') one, since a bare G-… can be a product code on a shop's front page.
    • nil when the landing page wasn't read, [] when it names none, so a 503 doesn't look like tracking lost.
  • Setting: data-audit.json gets tags, keyed by home URL without the scheme like public_roles: {"client.example": ["GTM-ABC1234"], "client.example/sv": []}.
  • Check (public), all at review level:
    • tag-missing:<host>:<id>: a declared tag is gone (tracking lost?)
    • tag-new:<host>:<id>: a tag that isn't declared (a changed or added container?)
    • tags-undeclared:<host>:<hash>: a site with tags and no declaration, flagged once so every site gets declared
    • No checkout means no judgment (the declaration lives in the repo). A declared site whose page wasn't read gets a problem note.

The audited sites' declarations follow as one PR per site repo.

Tests

go test ./..., go vet, gofmt -l clean. New: TestTags (parked copy, noscript, gtag load/config, a product code ignored, [] vs nil) and TestPublicTags (missing, new, undeclared, a subdirectory site, an unread page, no repo).

🤖 Generated with Claude Code

The prober records the GTM and GA4 IDs each home page names; the check
compares them with data-audit.json's new tags (by home URL without the
scheme). A declared tag gone or an undeclared one is a review flag; a
site with tags and no declaration is flagged once so it gets declared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oxyc
oxyc merged commit c0e162d into main Dec 2, 2026
2 checks passed
@oxyc
oxyc deleted the feat/tag-drift branch December 2, 2026 19:43
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