Repository navigation
feat(ui): add the metricool web tracker - #186
Merged
Merged
Conversation
Metricool needs its tracker on the site to attribute visits to social posts. It loads from a same-origin file so the CSP needs no new inline hash, and it reports ClientRouter navigations too, which a one-time snippet would miss. The tracker sets no cookies, so the privacy pages disclose it without a consent banner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 11, 2026
This branch was successfully deployed
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.
What
Adds the Metricool web tracker to every page.
public/scripts/metricool.jsloadshttps://tracker.metricool.com/resources/be.jsand reports a page view on load and on every ClientRouter navigation (astro:after-swap).Layout.astroincludes it withdeferin production builds only. The CSP allowshttps://tracker.metricool.cominscript-src(the script) andimg-src(itsc3po.jpgbeacon). The privacy pages (ES and EN) disclose it;docs/security.md,docs/performance.md, the README and the changelog are updated.Why
Metricool needs its tracker on the site to attribute visits to social media posts. The vendor snippet is an inline script, which the hash-based CSP would block and which would only count the first page of a visit under the ClientRouter; a same-origin file avoids a new hash and counts every navigation. The tracker sets no cookies (it sends one image request with URL, window size and referrer), so no consent banner is needed.
Test plan
npm run build- 34 pages builtnpm run csp:check- OK, 7 hashes, no new inline scriptnpm run lintandnpm run check- 0 errorsnpx prettier --checkon the changed files - cleannpm test- 1364 passed, 10 skipped (new assertions: CSP hosts insecurity-headers.spec.ts, Metricool disclosure inprivacy.spec.ts)dist/index.htmlanddist/en/index.htmlincludescripts/metricool.jsNot verified
🤖 Generated with Claude Code