Skip to content

Add first-party analytics gateway#6

Merged
yaacovcorcos merged 1 commit into
mainfrom
agent/analytics-gateway
Jul 20, 2026
Merged

Add first-party analytics gateway#6
yaacovcorcos merged 1 commit into
mainfrom
agent/analytics-gateway

Conversation

@yaacovcorcos

Copy link
Copy Markdown
Contributor

What changed

  • adds a dedicated Cloudflare Worker at events.scientfactory.com
  • stores website and desktop events in ScientFactory-owned D1 before any forwarding
  • forwards sanitized anonymous batches to the EU PostHog project only when its Worker secret is configured
  • migrates website event writes to the shared schema while retaining the historical table
  • updates reporting, tests, deployment scripts, and the public privacy notice

Why

ScientFactory needs one owned analytics ingestion path that can support the website and desktop app without coupling clients directly to PostHog. D1 remains the source of truth, and PostHog stays an optional analysis layer.

Validation

  • bun run check
  • local D1 migration validation for migrations 0001 and 0002
  • wrangler deploy dry-run for the events Worker
  • 33 Vitest tests passing

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying scientfactory-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: bbd78a4
Status: ✅  Deploy successful!
Preview URL: https://6a781ff3.scientfactory-website.pages.dev
Branch Preview URL: https://agent-analytics-gateway.scientfactory-website.pages.dev

View logs

@yaacovcorcos
yaacovcorcos marked this pull request as ready for review July 20, 2026 16:05
@yaacovcorcos
yaacovcorcos requested a review from YishayPo as a code owner July 20, 2026 16:05
@yaacovcorcos
yaacovcorcos merged commit d6ad895 into main Jul 20, 2026
2 checks passed
@yaacovcorcos
yaacovcorcos deleted the agent/analytics-gateway branch July 20, 2026 16:20
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