Add engagement events - #3
Merged
Merged
Conversation
GA4 enhanced measurement gives a pageview and one scroll event at 90%, which for an article built out of interactive figures answers neither useful question: was a figure touched, and where do people stop. Three events — read_depth at 25/50/75/100, widget_interact once per figure, and crosslink_click — inlined through SiteHead so both this page and the tool page get them, the same way they already share the analytics and social tags. The source is a copy of tools/engagement/engagement.js in the orbitope.github.io repo, imported with ?raw so it stays one file to edit rather than a snippet pasted into an .astro template. The two sites build in completely different ways, so a copy is the honest option; there is no shared package here. Verified against the built docs/ over a local server: nothing fires on load and all four depth marks fire on a full read. Co-Authored-By: Claude Opus 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.
Adds the three engagement events, matching the eight hand-written articles.
Why
GA4 enhanced measurement gives a pageview and one scroll event at 90%. For an article made of fifteen interactive 3D figures, that answers neither useful question: was a figure touched, and where do people stop.
Events
read_depthpercentwidget_interactidcrosslink_clicklink_urlWired through
SiteHead, so the tool page gets them too — the same reason the analytics and social tags already live there rather than in the layout.On the copied file
engagement.jsis a copy oftools/engagement/engagement.jsin the orbitope.github.io repo, imported with?rawso it stays one file to edit rather than a snippet pasted into an.astrotemplate. The two sites build in completely different ways and there is no shared package between them, so a copy is the honest option; the duplication is noted in both places.Verification
Built
docs/served locally and driven with a real browser, readingwindow.dataLayerwith Google's endpoints blocked: nothing fires on load, and all four depth marks fire on a full read.🤖 Generated with Claude Code