Architecture
analytics.svrbc.org is a static page on GitLab Pages that draws its own
charts. Its numbers come from PostHog, where every SVRBC site sends its
visits and clicks without cookies. They aren’t part of the site: every
hour a Lambda function asks PostHog for them and writes
data.json, which CloudFront serves and the page reads. The
page never talks to PostHog itself.
Dashed arrows: what a release does. Colored outlines: what serves this site.
-
The page is
site/index.htmlandsite/app.js: hand-drawn SVG charts, and every filter (site, host, range) applied in the browser todata.json. The filters are in the URL, so a link can open on one site. -
It is a PWA: it installs from the browser, and works
offline with the numbers it last fetched. Its service worker
(
sw.js) fetches pages anddata.jsonfresh when it can, and keeps everything else until a release replaces it. -
The numbers come from
scripts/fetch_data.py, run every hour by a Lambda function, which asks PostHog’s query API with a personal API key that can only read (kept in AWS SSM). A visitor is counted once a day: the sites set no cookies, so PostHog tells visitors apart by a hash that resets daily. The function, its schedule and the bucket are in the developer handbook’s infra/analytics-svrbc-org-data. -
A release is a merge request that bumps
VERSION. Once it merges, CI tags it, and the tag’s pipeline publishes//:siteand deploys the function’s code, running it once (Releases). Nothing else changes the page. -
The domain: a CNAME from
analytics.svrbc.orgtosvrbc.gitlab.io, in svrbc.org’s zone (Domains).data.jsonis on CloudFront’s own hostname. - Source: gitlab.com/svrbc/analytics.svrbc.org. What sites count, and how: Sites.