diff --git a/README.md b/README.md index 73f74df..0f8b522 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ from `web/dist/` (CloudFront's `default_root_object` is `index.html`, so `/client-metadata.json`. The frontpage copy is intentionally `PLACEHOLDER-*` strings until real wording is written. +The frontpage (and only the frontpage — not the extension) reports analytics +to an EU-hosted PostHog project via `web/src/components/PostHog.astro`. +Tracking is cookieless (`persistence: "memory"`), and the snippet is only +included in production builds, so `astro dev` traffic never reaches PostHog +(`astro preview` serves the production build, so it does). + Build the frontpage before planning or applying — the site objects are read from the build output, and a plan-time precondition fails if `web/dist/index.html` is missing (otherwise an empty `fileset()` would diff --git a/web/src/components/PostHog.astro b/web/src/components/PostHog.astro new file mode 100644 index 0000000..2a9e40b --- /dev/null +++ b/web/src/components/PostHog.astro @@ -0,0 +1,66 @@ +--- +// PostHog analytics for the static frontpage only (the extension does not +// load this). EU-hosted project: https://eu.posthog.com/project/244032 +// +// persistence: "memory" keeps tracking cookieless — nothing is written to +// cookies or localStorage, so visitors are not recognized across visits and +// no consent banner is required. +--- + + diff --git a/web/src/layouts/Layout.astro b/web/src/layouts/Layout.astro index 5207177..38ea321 100644 --- a/web/src/layouts/Layout.astro +++ b/web/src/layouts/Layout.astro @@ -1,5 +1,6 @@ --- import "../styles/global.css"; +import PostHog from "../components/PostHog.astro"; interface Props { title: string; @@ -17,6 +18,8 @@ const { title, description } = Astro.props;