Skip to content

fix(website): restore GA4 alongside PostHog (analytics continuity) - #5467

Merged
mmabrouk merged 1 commit into
mainfrom
fix/website-ga4-continuity
Jul 23, 2026
Merged

mmabrouk merged 1 commit into
mainfrom
fix/website-ga4-continuity

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

GA showed zero new users after the cutover because the Framer site injected GA4 via Framer's integration, and the rebuilt site shipped only PostHog — GA was never disconnected, it was never included.

This restores the same GA4 property (measurement ID G-368ZWZSH5D, recovered from the Wayback snapshot of the Framer site and matching the ID already documented in website/.env.example). It loads with the exact same gates as PostHog: only on agenta.ai/www, only in indexable production builds, honoring Do Not Track — so previews and dev send nothing. The production workflow provides the ID at build time.

Merging auto-deploys production and GA data resumes.

https://claude.ai/code/session_013Qe1Vf2yvj33BVd5W1q7HB

The Framer site carried GA4 (G-368ZWZSH5D, recovered from the archive and
matching .env.example); the rebuild shipped only PostHog, so GA flatlined
at cutover. Same gates as PostHog: real domain, indexable production
build, DNT honored. The production workflow sets the public ID.

Claude-Session: https://claude.ai/code/session_013Qe1Vf2yvj33BVd5W1q7HB
@vercel

vercel Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 23, 2026 4:04pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-5467-agenta-website-preview.mahmoud-637.workers.dev

Built from 567bf38a9626b780a500601097c6cd10e4442c87. This comment updates in place on every push.

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. frontend labels Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 373d853a-e20a-4c7c-999b-12dde745dd41

📥 Commits

Reviewing files that changed from the base of the PR and between 297eb1e and 567bf38.

📒 Files selected for processing (2)
  • .github/workflows/16-website-production.yml
  • website/src/components/Analytics.astro

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added Google Analytics 4 tracking for production website visits.
    • Analytics respects production, indexing, and “Do Not Track” settings.
    • Existing analytics behavior remains unchanged.

Walkthrough

Production builds now expose a GA4 measurement ID. The website analytics component conditionally injects the GA4 script and initializes gtag alongside PostHog when production, indexing, and DNT checks allow analytics.

Changes

GA4 Analytics

Layer / File(s) Summary
Production GA4 wiring and initialization
.github/workflows/16-website-production.yml, website/src/components/Analytics.astro
The production build receives PUBLIC_GA_ID, and the analytics component performs one-time GA4 script injection and configuration under the existing runtime gates.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • Agenta-AI/agenta#5449: Extends the same analytics bootstrapping area with related GA4 and PostHog changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: restoring GA4 analytics alongside PostHog on the website.
Description check ✅ Passed The description is directly related and accurately explains the GA4 restore and runtime gating changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/website-ga4-continuity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmabrouk
mmabrouk merged commit 7b971d8 into main Jul 23, 2026
10 checks passed

This branch was successfully deployed

1 active deployment
Preview — 567bf38a Deployed Jul 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants