Skip to content

feat(open-knowledge): track downloads and updates per version#352

Merged
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync
Jun 27, 2026
Merged

feat(open-knowledge): track downloads and updates per version#352
inkeep-oss-sync[bot] merged 1 commit into
mainfrom
copybara/sync

Conversation

@inkeep-oss-sync

Copy link
Copy Markdown
Contributor

No description provided.

* feat(open-knowledge): track downloads and updates per version

Server-side, privacy-respecting download and update telemetry for the docs
site, with no user IP and no PII.

- New docs/src/lib/track.ts posts events to the existing PostHog project from
  the server, so PostHog never sees the visitor IP. It forces $ip:null and
  $geoip_disable, strips undefined props, and reuses the posthog-js cookie's
  distinct_id when present (else a random UUID). Capture runs in after() so it
  never blocks or breaks a redirect, and never throws.
- /download/stable and /download/beta now emit dmg_downloaded (channel plus
  hostname-only referrer). The stable route is served no-store so the CDN
  cannot swallow per-download counts.
- New /updates/[channel]/[...path] proxy 302s electron-updater requests to the
  byte-identical GitHub asset and emits app_update_downloaded only for the mac
  zip, with to_version parsed from the filename and from_version from an
  x-ok-from-version header. Manifests, blockmaps and the dmg are redirected but
  not counted. No client points at it yet; it is infrastructure for a later
  desktop change that repoints the updater feed here.
- Download CTAs link the tracked /download/stable route. next/link would
  prefetch a redirect route handler (firing the redirect and inflating counts)
  and double-fetch on click, so MarketingButton and DownloadButton render a raw
  anchor for /download and /updates hrefs, matching app/d/[encoded]/
  splash-buttons.tsx. The JSON-LD downloadUrl keeps the real file URL for SEO.
- Repoint the public README macOS download link to openknowledge.ai/download/
  stable so README and launch traffic is counted.

Docs-only, so no changeset. Persistent-install-id active-user tracking stays
deferred pending the opt-in/opt-out decision. SPEC under specs/.

* chore(open-knowledge): address review on download/update tracking

- track.ts: surface PostHog 4xx/5xx responses (check res.ok) instead of
  silently dropping events.
- /updates proxy: validate the x-ok-from-version header before it reaches
  PostHog, count only a real mac-update zip (parseable version required),
  serve 404/503 with no-store, and log the stale-LKG beta-tag case.
- Tests: add the share-splash download route (cookie set + unconditional
  capture), the beta 503 fallback path, an x64 artifact, and resolveDistinctId
  empty-id / multi-cookie cases.

GitOrigin-RevId: 6936fd9d3e996e3fc60fb77d49a646e44be983c1

@inkeep-internal-ci inkeep-internal-ci Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/28297835143). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.

@inkeep-oss-sync inkeep-oss-sync Bot merged commit 32cc0c5 into main Jun 27, 2026
@inkeep-oss-sync inkeep-oss-sync Bot deleted the copybara/sync branch June 27, 2026 18:29
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