Skip to content

feat(analytics): route GA4 through GTM and instrument engagement events - #2300

Open
GigaHierz wants to merge 2 commits into
mainfrom
GigaHierz/expand-ga-analytics-hooks
Open

feat(analytics): route GA4 through GTM and instrument engagement events#2300
GigaHierz wants to merge 2 commits into
mainfrom
GigaHierz/expand-ga-analytics-hooks

Conversation

@GigaHierz

@GigaHierz GigaHierz commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What

Upgrades docs.celo.org measurement beyond bare page views. One concern: analytics instrumentation.

  • docs.json: swap integrations.ga4 for integrations.gtm. The GA4 Google Tag (same property, G-0CXEKQ81V2, so reporting history stays continuous) moves inside the GTM container; keeping both would double-count page views. Container GTM-NP9GP2BT is created and published with the GA4 Google Tag.
  • snippets/AddNetworkButton.jsx: push dataLayer events for the add-network conversion — add_network_click and add_network_result (success / rejected / error / no_wallet). Highest-intent action on the site, previously untracked.
  • ANALYTICS.md (new, internal — not in navigation, so not a public page): architecture and three runbooks — GTM container tags/triggers, GA4 property config (AI-assistant channel group, custom dimensions, exit-page explorations), and Cloudflare AI Crawl Control for bot/agent traffic, which no client-side tag can see (AI crawlers don't execute JS).
  • AGENTS.md: one-line pointer to ANALYTICS.md.

Why

The site had a single GA4 measurement ID and nothing else: no referrer/drop-off/engagement instrumentation and zero visibility into AI-agent traffic, which reads llms.txt and .md variants directly. GTM (free) is the only sanctioned route to custom event tracking on Mintlify hosting without a plan upgrade; Cloudflare (free) is the only layer that can count non-JS bots.

Before merge

  • GTM container created and published with the GA4 Google Tag (runbook 1 in ANALYTICS.md)
  • Real container ID replaces GTM-XXXXXXX in docs.json
  • Ownership table in ANALYTICS.md filled in

Verification

mint broken-links on the branch head:

success no broken links found

snippets/AddNetworkButton.jsx syntax-checked with esbuild (compiles clean). No pages moved; no redirects needed.

🤖 Generated with Claude Code

GigaHierz and others added 2 commits August 31, 2026 22:29
Swap the bare ga4 integration in docs.json for GTM (tagId placeholder
until the container is created), fire dataLayer events from
AddNetworkButton for the add-network conversion, and document the
measurement setup in ANALYTICS.md: GTM/GA4 runbooks for humans and a
Cloudflare AI Crawl Control runbook for bot/agent traffic, which no
client-side tag can see.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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