Skip to content

feat(analytics): first-party tracker via /_a (ADR-0006 Phase 2c)#43

Merged
cewert merged 1 commit into
mainfrom
adr0006/phase2c-firstparty-embed
May 31, 2026
Merged

feat(analytics): first-party tracker via /_a (ADR-0006 Phase 2c)#43
cewert merged 1 commit into
mainfrom
adr0006/phase2c-firstparty-embed

Conversation

@cewert
Copy link
Copy Markdown
Member

@cewert cewert commented May 31, 2026

Phase 2c of ADR-0006. Switches the api-docs footer Umami embed from cross-origin analytics.jellyrock.app/script.js to the same-origin first-party proxy (/_a/script.js), live since infra #27.

<script defer src="/_a/script.js" data-website-id="…" data-host-url="https://api.jellyrock.app/_a"></script>
  • Tracker POSTs to https://api.jellyrock.app/_a/api/send → Caddy strips /_a → umami /api/send.
  • No CSP risk: /_a/script.js is 'self'. Shared CSP tightens in the final infra phase.
  • analytics.jellyrock.app stays live as rollback (Bridge).

Verification

  • jsdoc.json is valid JSON; footer embeds /_a/script.js + data-host-url, 0 legacy origin refs.
  • The deploy rebuilds the JSDoc site fresh on merge, propagating the footer to every page.
  • Post-deploy gate: analytics-health.sh --only api-docs → first-party/ok.

Switch the api.jellyrock.app footer tracker from cross-origin
analytics.jellyrock.app/script.js to the same-origin /_a proxy (live since
infra #27):

  <script defer src="/_a/script.js" data-website-id="…"
          data-host-url="https://api.jellyrock.app/_a"></script>

Events POST to /_a/api/send → Caddy strips to umami's /api/send. Works under the
current CSP (/_a/script.js is 'self'); shared CSP tightens in the final infra
phase. analytics.jellyrock.app stays live as rollback (Bridge scope).

Verified: jsdoc.json is valid JSON; footer embeds /_a/script.js + data-host-url
with zero analytics.jellyrock.app references.
@cewert cewert merged commit d305a45 into main May 31, 2026
1 check passed
@cewert cewert deleted the adr0006/phase2c-firstparty-embed branch May 31, 2026 12:57
cewert added a commit that referenced this pull request May 31, 2026
…06 Phase 2c) (#44)

#43 updated jsdoc.json (the config), but api-docs deploys by rsyncing the
COMMITTED docs/ build artifact — it does not build on deploy — so the live
site still served the cross-origin tracker. This regenerates the footer in the
committed HTML to match the updated jsdoc.json.

Uniform, surgical swap across all 545 generated pages:
  - src="https://analytics.jellyrock.app/script.js"
  + src="/_a/script.js" … data-host-url="https://api.jellyrock.app/_a"

Identical to what `npm run build` now emits (jsdoc.json is already first-party
on main), so the next code-update regeneration produces no footer diff. Events
POST to /_a/api/send → Caddy strips to umami /api/send. analytics.jellyrock.app
stays live as rollback (Bridge).
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