Closed
feat: add Plausible privacy-focused analytics to all HTML pages#350
Conversation
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement privacy-focused analytics and monitoring for news articles
feat: add Plausible privacy-focused analytics to all HTML pages
Feb 19, 2026
Contributor
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
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.
No analytics existed to measure user engagement or validate the ROI of 176 recent article enhancements. This adds Plausible Analytics — cookie-free, GDPR-compliant, no consent banner required — across all 545 HTML pages.
New files
js/plausible-events.js— IIFE with Plausible queue polyfill, scroll-depth milestones (25/50/75/100%), a one-shotArticle Readevent at 75%, andDocument Clicktracking on.document-linkelements. Language inferred from<html lang>, article type from URL pattern.scripts/add-analytics.py— Idempotent script that back-fills all existing HTML with the Plausible loader (<head>) and the events script (</body>), computing the correct relative path depth automatically.tests/plausible-events.test.js— 29 tests: polyfill fallback, language/article-type detection, all 4 scroll milestones,Article Readdeduplication,Document Clickprops.Template update
scripts/article-template.jsupdated so every future auto-generated article includes both tags without manual intervention.Custom events shape
Privacy
No cookies, no PII, no fingerprinting. Script loaded with
deferover HTTPS. No consent banner needed under GDPR.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.