Skip to content

feat(desktop): capture os_platform and os_arch on analytics events - #83094

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/desktop-analytics-os-platform-arch
Aug 14, 2026
Merged

feat(desktop): capture os_platform and os_arch on analytics events#83094
trunk-io[bot] merged 1 commit into
masterfrom
posthog/desktop-analytics-os-platform-arch

Conversation

@tatoalo

@tatoalo tatoalo commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Problem

Electron's user agent reports Intel Mac OS X on every Mac, including Apple Silicon, so $os collapses arm64 and x64 into one bucket. The only way to guess the arm/Intel mix today is release asset download counts, which is not ideal.

Changes

  • OsService.getHostInfo() returns { platform, arch } from the existing IAppMeta, exposed as the os.getHostInfo tRPC query with a Zod output schema.
  • The renderer registers os_platform / os_arch as posthog-js super properties at boot, re-applied after posthog.reset() alongside app_version.
  • Main-process track / captureException stamp the same two properties.

@trunk-io

trunk-io Bot commented Aug 14, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Aug 14, 2026
@PostHog PostHog deleted a comment from github-actions Bot Aug 14, 2026
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit b72cd4b.

@tatoalo
tatoalo marked this pull request as ready for review August 14, 2026 10:40
@tatoalo
tatoalo requested a review from a team August 14, 2026 10:40
@hosthog

hosthog Bot commented Aug 14, 2026

Copy link
Copy Markdown

HostHog preview — posthog-desktop-web

Latest build (b72cd4b): https://5999b76c49774ca48278a21c391305fa.hosthog.dev

Earlier builds of this PR, still serving:

Employee-gated; every push gets a fresh URL whose content never changes. All previews stop serving when the PR closes.

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
### Issue 1
products/desktop/apps/code/src/renderer/contributions/app-boot.contributions.ts:32-37
**Promise-chain boot request**

The new host-info request uses `.then()` and `.catch()` instead of the repository-preferred async/await style, making initialization and error handling inconsistent with the project convention.

### Issue 2
products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts:53-55
**Missing helper return type**

The new `hostInfoProperties` helper relies on an inferred return shape, contrary to the repository convention requiring explicit return types for frontend TypeScript functions.

```suggestion
function hostInfoProperties({
  platform,
  arch,
}: HostInfoProperties): Record<string, string> {
  return { os_platform: platform, os_arch: arch };
}
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(desktop): capture os_platform and o..." | Re-trigger Greptile

Comment thread products/desktop/apps/code/src/renderer/contributions/app-boot.contributions.ts Outdated
Comment thread products/desktop/packages/ui/src/shell/posthogAnalyticsImpl.ts Outdated
Electron's user agent reports "Intel Mac OS X" on every Mac, so $os cannot distinguish arm64 from x64 installs. Expose IAppMeta.platform/.arch through OsService and register them as super properties in the renderer, and add them to main-process captures.

Generated-By: PostHog Desktop
Task-Id: 91f0d0a8-d9e8-41d1-a096-942b34f72dcb
@tatoalo
tatoalo force-pushed the posthog/desktop-analytics-os-platform-arch branch from 631981d to b72cd4b Compare August 14, 2026 10:55
@trunk-io

trunk-io Bot commented Aug 14, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@trunk-io
trunk-io Bot merged commit a4ec330 into master Aug 14, 2026
206 checks passed
@trunk-io
trunk-io Bot deleted the posthog/desktop-analytics-os-platform-arch branch August 14, 2026 11:40
@deployment-status-posthog

deployment-status-posthog Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-08-14 12:15 UTC Run
prod-us ✅ Deployed 2026-08-14 13:59 UTC Run
prod-eu ✅ Deployed 2026-08-14 13:19 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/desktop Feature Tag: Desktop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants