diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index ba4b84d5..aa97b230 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -5,7 +5,7 @@ import starlightPageActions from "starlight-page-actions"; import { codeHeader } from "./src/code-header.ts"; import { basalt, bone } from "./src/code-themes.ts"; import { SIDEBAR } from "./src/sidebar.ts"; -import { DESCRIPTION, PROMPT, SITE, socialImage } from "./src/site.ts"; +import { analytics, DESCRIPTION, PROMPT, SITE, socialImage } from "./src/site.ts"; // The fonts of bounda.dev, self-hosted at build time with metric-matched fallbacks. Science Gothic // is only ever set at 600, so it is requested at that one weight across the width axis it uses. @@ -55,7 +55,7 @@ export default defineConfig({ }, description: DESCRIPTION, customCss: ["./src/styles/bounda.css"], - head: socialImage(`${SITE}/og.jpg`), + head: [...socialImage(`${SITE}/og.jpg`), analytics], routeMiddleware: "./src/route-data.ts", // src/pages/404.astro keeps the sidebar and offers the search. disable404Route: true, diff --git a/docs/src/site.ts b/docs/src/site.ts index e878f716..177cd2e7 100644 --- a/docs/src/site.ts +++ b/docs/src/site.ts @@ -2,6 +2,16 @@ export const SITE = "https://docs.bounda.dev"; export const REPOSITORY = "https://github.com/bounda-dev/bounda"; +// Cloudflare Web Analytics, without cookies; the site is bounda.dev's, which counts this subdomain too. +export const analytics: HeadTag = { + tag: "script", + attrs: { + type: "module", + src: "https://static.cloudflareinsights.com/beacon.min.js", + "data-cf-beacon": '{"token": "26093f976db946eeba633b04b7def982"}', + }, +}; + export const DESCRIPTION = "Event sourcing and CQRS for TypeScript without the ceremony."; // What a page hands to a chat; `{url}` becomes the page's address. @@ -15,8 +25,8 @@ const socialImageAlt = "The Bounda symbol as a machined monolith whose foot becomes the global stream, beside the headline: Event sourcing without the ceremony."; export interface HeadTag { - readonly tag: "meta"; - readonly attrs: { readonly property?: string; readonly name?: string; readonly content: string }; + readonly tag: "meta" | "script"; + readonly attrs: Readonly>; } export interface SocialImageFunction {