Add Google Analytics 4 and Microsoft Clarity - #223
Draft
yomach wants to merge 3 commits into
Draft
Conversation
This site had no web analytics. Adds GA4 (Material's native provider hook) and a consent-gated Microsoft Clarity snippet, plus a cookie consent banner (previously absent) covering both. Placeholder IDs (G-REPLACE_WITH_NEW_MEASUREMENT_ID, Clarity project ID) must be replaced once the new shared GA4/Clarity accounts are created. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBfKWmY9rLhRT6LuSAcgmj
Both were commented out. site_url now matches the actual GitHub Pages URL (qua-platform.github.io/quam), which also benefits GA4/canonical link generation added in this branch. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBfKWmY9rLhRT6LuSAcgmj
Verified against Material's actual consent.html template (squidfunk/mkdocs-material): a plain-string cookie entry (e.g. `analytics: Google Analytics`) always defaults to checked=true, and the "github" category is only meaningful when repo_url is set to a github.com URL — which none of the 4 sibling sites configure. Drops the github entry and switches analytics to the expanded form with an explicit checked: false, matching clarity's opt-in default. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WBfKWmY9rLhRT6LuSAcgmj
yomach
force-pushed
the
analytics/ga4-clarity
branch
from
July 29, 2026 16:13
209ad9c to
487d016
Compare
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.
Summary
analytics.provider: googlehook) and a consent-gated Microsoft Clarity snippet (docs/js/clarity.js).analytics,github, and a newclaritycategory (defaults unchecked — proper opt-in).Why draft
G-REPLACE_WITH_NEW_MEASUREMENT_IDandREPLACE_WITH_CLARITY_PROJECT_IDare placeholders. This is one of 4 sibling PRs (documentation-website, qualibrate, quam, quarc) sharing one dedicated GA4-owning Google account and one Clarity account, both still to be created. Will move to Ready for Review once real IDs are in.Note:
site_urlinmkdocs.ymlis still commented out (pre-existing) — left untouched pending a separate decision on whether to set it.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
https://claude.ai/code/session_01WBfKWmY9rLhRT6LuSAcgmj
Review response
Same finding surfaced on the sibling documentation-website PR (#386), extrapolated here since this PR used the identical
cookies:pattern. Pulled Material's actualpartials/consent.htmltemplate source to verify rather than assume:githubcookie removed. It's gated in the template behindconfig.repo_urlcontaininggithub.com— confirmed via source, and confirmed via grep that none of the 4 sibling sites setrepo_url. Functionally dead checkbox; dropped.analyticsswitched to the expanded{name, checked: false}form. The template defaults plain-string cookie entries tochecked="checked"(pre-opted-in) — fixed for a real, consistent opt-in default matchingclarity.docs/js/clarity.js's script-eval-time__md_get("__consent")check is sufficient as written.