Skip to content

feat(ui): add the metricool web tracker - #186

Merged
github-actions[bot] merged 1 commit into
devfrom
feature/metricool-tracker
Nov 10, 2026
Merged

github-actions[bot] merged 1 commit into
devfrom
feature/metricool-tracker

Conversation

@wavival

@wavival wavival commented Nov 10, 2026

Copy link
Copy Markdown
Owner

What

Adds the Metricool web tracker to every page. public/scripts/metricool.js loads https://tracker.metricool.com/resources/be.js and reports a page view on load and on every ClientRouter navigation (astro:after-swap). Layout.astro includes it with defer in production builds only. The CSP allows https://tracker.metricool.com in script-src (the script) and img-src (its c3po.jpg beacon). 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 built
  • npm run csp:check - OK, 7 hashes, no new inline script
  • npm run lint and npm run check - 0 errors
  • npx prettier --check on the changed files - clean
  • npm test - 1364 passed, 10 skipped (new assertions: CSP hosts in security-headers.spec.ts, Metricool disclosure in privacy.spec.ts)
  • dist/index.html and dist/en/index.html include scripts/metricool.js

Not verified

  • That page views arrive in the Metricool dashboard: needs the production deployment.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wavival-dev Ready Ready Preview Nov 10, 2026 9:32pm UTC

@github-actions
github-actions Bot enabled auto-merge November 10, 2026 21:31
@github-actions
github-actions Bot merged commit d3a80fd into dev Nov 10, 2026
15 checks passed
@wavival
wavival deleted the feature/metricool-tracker branch November 11, 2026 01:16

This branch was successfully deployed

1 active deployment
Preview — 3f027815 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant