Repository navigation
Track page views with policyengine.org's Google Analytics - #101
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inapp/public/: the simulator (index.html),paper/index.htmlandpaper-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-v2website/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 onmainwithout this change.test_events_section,test_migrations_wrapper,test_asset_versioning,test_paper_embed,test_retired_claims) pass.app/public/index.html(not the<head>), so a small rebase may be needed.🤖 Generated with Claude Code