feat(open-knowledge): track downloads and updates per version#352
Merged
Conversation
* 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
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.