Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Site analytics with HeyCatch on g1t.sh, with names removed inside the app; the privacy policy says so | 1 | /** |
| 2 | * Product analytics (HeyCatch), on g1t.sh only: pageviews, clicks and | |
| 3 | * route changes, captured from the first page. Every event passes through | |
| 4 | * lib/analytics-scrub.ts first, so inside the app names, text and titles | |
| 5 | * never leave the browser, and recordings are never sent. A signed-in | |
| 6 | * person is known by their account id alone (`identify` below). | |
| 7 | * | |
| 8 | * Imported once, statically, by entry.client.tsx, so it runs before the | |
| 9 | * app does. A self-hosted g1t sends nothing. | |
| 10 | */ | |
| 11 | import { analytics } from "@heycatch/sdk"; | |
| 12 | ||
| 13 | import { scrubEvent } from "./analytics-scrub"; | |
| 14 | ||
| 15 | /** The one installation analytics runs on. */ | |
| 16 | const HOSTED = "g1t.sh"; | |
| 17 | ||
| 18 | const enabled = window.location.hostname === HOSTED; | |
| 19 | ||
| 20 | if (enabled) { | |
| 21 | analytics.init({ | |
| 22 | projectKey: "hck_pk_EsF6nrWNZ0tOM4cmDKA6tKBzdTr-GEW3", | |
| 23 | install: { framework: "react", frameworkVersion: "19", agent: "claude-code" }, | |
| 24 | respectDnt: true, | |
| 25 | beforeSend: (event) => scrubEvent(event, window.location.pathname, window.location.origin), | |
| 26 | }); | |
| 27 | } | |
| 28 | ||
| 29 | /** Who is signed in, by account id only; null after signing out. */ | |
| 30 | export function identify(userId: string | null, previous: string | null) { | |
| 31 | if (!enabled) return; | |
| 32 | if (userId) analytics.setIdentity(userId); | |
| 33 | else if (previous) analytics.resetIdentity(); | |
| 34 | } |