Skip to content

Track page views with policyengine.org's Google Analytics - #101

Merged
PavelMakarchuk merged 1 commit into
mainfrom
ga-page-views
Oct 29, 2026
Merged

PavelMakarchuk merged 1 commit into
mainfrom
ga-page-views

Conversation

@PavelMakarchuk

Copy link
Copy Markdown
Contributor

Why

The page at https://policyengine.org/us/snap-payment-error-simulator sends no page views. policyengine.org serves this app through a rewrite, and the main site's Google Analytics does not reach an app served that way.

What changed

Added the two gtag <script> tags to the <head> of the three hand-written top-level pages in app/public/: the simulator (index.html), paper/index.html and paper-migrations/index.html. The Quarto renders under */web/ load inside an iframe on those pages, so I did not edit the generated HTML.

The tag uses policyengine.org's GA4 property (G-2YHG89FY0N) and the same snippet as policyengine-app-v2 website/src/app/layout.tsx. It sends page views only: no custom events, no user inputs or results.

How I tested

  • uv run --extra dev --extra analysis pytest tests: 410 passed, 19 skipped, 2 failed. The 2 failures (tests/test_engine_scenario.py, a data gate for AK) also fail on main without this change.
  • The front-end tests that read these HTML files (test_events_section, test_migrations_wrapper, test_asset_versioning, test_paper_embed, test_retired_claims) pass.
  • Note: open PR Lead the simulator with the selected state's answer #100 also edits app/public/index.html (not the <head>), so a small rebase may be needed.

🤖 Generated with Claude Code

This app is served at policyengine.org/us/snap-payment-error-simulator through a rewrite, where the
main site's GA does not reach. Add the GA4 tag (G-2YHG89FY0N), page views only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PavelMakarchuk
PavelMakarchuk merged commit 068350e into main Oct 29, 2026
1 check passed
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