PostHog for Cheshire Terminal
Project
| Key | Value |
|---|---|
| Cloud | US https://us.i.posthog.com |
| Project ID | 473072 |
| Inbox | https://us.posthog.com/project/473072/inbox |
| Replay | Product Analytics → Session replay |
Operating flow
- Respect privacy first — no capture until analytics opt-in
- Browser:
client/src/lib/posthog.ts(cookieless memory persistence) - Server:
server/lib/posthog.ts(posthog-node) - Identify wallet on connect and session restore
- Capture named product events only (see events reference)
- Verify in Network tab + PostHog Live events
Load details when needed:
- references/events.md — product event catalog
- references/privacy.md — cookieless + opt-in rules
- scripts/check-posthog-env.sh — env readiness (no secret print)
Env
POSTHOG_API_KEY=phc_... # server (posthog-node)
POSTHOG_HOST=https://us.i.posthog.com
VITE_POSTHOG_KEY=phc_... # browser (optional; client has project default)
VITE_POSTHOG_HOST=https://us.i.posthog.com
VITE_POSTHOG_DISABLED=true # hard kill switch for browser
Never commit raw keys; never log them.
Browser (posthog-js)
// client/src/lib/posthog.ts
posthog.init(key, {
api_host: "https://us.i.posthog.com",
defaults: "2026-05-30",
person_profiles: "identified_only",
capture_pageview: false, // SPA pageviews via capturePageView()
persistence: "memory",
disable_persistence: true,
opt_out_capturing_by_default: true,
disable_session_recording: !allowReplay,
});
Helpers:
| Helper | When |
|---|---|
initPostHog() |
App boot |
identifyWallet(address) |
SIWS connect + session restore |
capturePageView(path) |
SPA route change (if opted in) |
captureEvent(name, props) |
Product events |
resetPostHogIdentity() |
Logout / wallet disconnect |
applyPrivacyToPostHog() |
Privacy prefs changed |
Server (posthog-node)
server/lib/posthog.ts — singleton with exception autocapture. Capture from routes after successful mutations (pump, dbc, agents, staking, auth). Always pass distinctId as wallet or stable principal — never raw secrets.
Verify
- Opt into analytics in privacy UI
- Network → requests to
us.i.posthog.com - Wallet connect → person identified by address
- Session replay only if analytics and replay opted in
- Live events: wallet_connected, pageviews, product actions
bash skills-store/posthog-cheshire/scripts/check-posthog-env.sh
Rules
- Cookieless by default — no tracking cookies
- No capture without explicit analytics consent
- Do not attach private keys, seed phrases, full API keys, or raw JWT secrets to events
- Prefer wallet address as
distinctIdfor holder identity - Keep event names snake_case and stable (see events reference)