Skip to content

[codex] Add PostHog telemetry for weekly active users#96

Merged
samuelstroschein merged 3 commits into
mainfrom
telemetry
Jun 12, 2026
Merged

[codex] Add PostHog telemetry for weekly active users#96
samuelstroschein merged 3 commits into
mainfrom
telemetry

Conversation

@samuelstroschein

@samuelstroschein samuelstroschein commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

  • add an Electron-side PostHog HTTP capture service for packaged app launches
  • generate a build-time env variables module for the public PostHog token and optional host
  • include the generated env module in macOS packaging and wire release secrets into the build

Impact

Flashtype now emits one app_opened event per packaged app startup using a stable anonymous install ID stored in Electron userData. PostHog WAU can be tracked as unique users for app_opened over a weekly interval.

Validation

  • pnpm run build:env-variables
  • pnpm run lint
  • pnpm run typecheck

Note

Medium Risk
Introduces outbound analytics on startup and bakes the PostHog project key into release artifacts via CI; failures are non-blocking but privacy and secret-handling in builds should be reviewed.

Overview
Adds PostHog telemetry for packaged macOS builds so weekly active use can be measured from a single app_opened event per startup.

A new Electron main-process module sends an HTTP capture to PostHog when the app is ready, but only when app.isPackaged and a token is present. It uses a stable anonymous distinct_id stored under Electron userData (telemetry.json), with race-safe creation via exclusive file write.

Build-time wiring: scripts/write-env-variables.mjs generates build/env-variables.mjs from PUBLIC_POSTHOG_TOKEN / POSTHOG_PROJECT_API_KEY, optional PUBLIC_POSTHOG_HOST / POSTHOG_HOST, and package.json version. package:mac and release:mac run build:env-variables before packaging; electron-builder.yml ships that module in the app bundle. The macOS release workflow passes PostHog secrets/vars into the build step. Generated build/* artifacts are gitignored.

Reviewed by Cursor Bugbot for commit 1d6d83f. Bugbot is set up for automated code reviews on this repo. Configure here.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
flashtype-website 1d6d83f Commit Preview URL

Branch Preview URL
Jun 12 2026, 12:17 AM

@samuelstroschein samuelstroschein marked this pull request as ready for review June 12, 2026 00:02
Comment thread electron/telemetry.mjs Outdated
Comment thread electron/telemetry.mjs Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eb7c0e1. Configure here.

Comment thread electron/telemetry.mjs Outdated
@samuelstroschein samuelstroschein merged commit 73305ce into main Jun 12, 2026
3 of 4 checks passed
@samuelstroschein samuelstroschein deleted the telemetry branch June 12, 2026 00:17
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