feat(analytics): add Umami tracking script with preconnect
ci / build-and-test (push) Canceled after 0s

Add the Umami analytics tracker (privacy-friendly, no cookies, GDPR
compliant by default) to BaseLayout. Two perf-conscious choices:

- script is:inline defer — Astro emits it as-is without bundling,
  and defer keeps it off the critical render path
- preconnect to https://stats.itziarzameza.dev — DNS/TCP/TLS
  handshake happens in parallel with other resources, so the actual
  script fetch is amortized

Website ID a2067ef9-b05a-4147-9a18-31743d615716 is hardcoded as a
data attribute; rotate via a build env var if it ever needs to
change across environments.
This commit is contained in:
2026-07-27 15:08:09 +02:00
parent 501a1d602c
commit 328c0331a2
+3
View File
@@ -88,6 +88,7 @@ const jsonLd = JSON.stringify({
<link rel="alternate" hreflang="x-default" href={canonicalUrl} />
<link rel="sitemap" type="application/xml" href="/sitemap-index.xml" />
<link rel="preconnect" href="https://basemaps.cartocdn.com" crossorigin />
<link rel="preconnect" href="https://stats.itziarzameza.dev" />
<link rel="alternate" type="application/rss+xml" title="Ibiza Environmental Watch" href="/rss.xml" />
<meta property="og:title" content={title} />
@@ -107,6 +108,8 @@ const jsonLd = JSON.stringify({
<meta name="twitter:image" content={socialImageUrl} />
<meta name="twitter:image:alt" content={ogImageAlt} />
<script is:inline type="application/ld+json" set:html={jsonLd}></script>
<script is:inline defer src="https://stats.itziarzameza.dev/script.js" data-website-id="a2067ef9-b05a-4147-9a18-31743d615716"></script>
</head>
<body>
<a class="skip-link" href="#main-content">Saltar al contingut</a>