Unverified 提交 d2aed44c authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

Add isPro person property to PostHog telemetry (#2285)

## Summary - Set `isPro` as a person property in PostHog when settings are loaded and updated - Enables segmenting analytics by pro user status - Reuses existing `hasDyadProKey` helper for consistency ## Test plan - [x] Lint passes - [x] TypeScript type check passes - [ ] Manual verification that PostHog receives the person property #skip-bugbot 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Set an isPro person property in PostHog when settings load and whenever they update, enabling analytics segmentation by Pro status. Reuses hasDyadProKey and aligns the app:initial-load event’s isPro with the same logic. <sup>Written for commit 376d4ab5ca9102c25edd43b83e1ea4d8622aa171. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
上级 6c8151ae
...@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from "react"; ...@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from "react";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import { userSettingsAtom, envVarsAtom } from "@/atoms/appAtoms"; import { userSettingsAtom, envVarsAtom } from "@/atoms/appAtoms";
import { IpcClient } from "@/ipc/ipc_client"; import { IpcClient } from "@/ipc/ipc_client";
import { type UserSettings } from "@/lib/schemas"; import { type UserSettings, hasDyadProKey } from "@/lib/schemas";
import { usePostHog } from "posthog-js/react"; import { usePostHog } from "posthog-js/react";
import { useAppVersion } from "./useAppVersion"; import { useAppVersion } from "./useAppVersion";
...@@ -36,9 +36,11 @@ export function useSettings() { ...@@ -36,9 +36,11 @@ export function useSettings() {
ipcClient.getEnvVars(), ipcClient.getEnvVars(),
]); ]);
processSettingsForTelemetry(userSettings); processSettingsForTelemetry(userSettings);
const isPro = hasDyadProKey(userSettings);
posthog.people.set({ isPro });
if (!isInitialLoad && appVersion) { if (!isInitialLoad && appVersion) {
posthog.capture("app:initial-load", { posthog.capture("app:initial-load", {
isPro: Boolean(userSettings.providerSettings?.auto?.apiKey?.value), isPro,
appVersion, appVersion,
}); });
isInitialLoad = true; isInitialLoad = true;
...@@ -66,6 +68,7 @@ export function useSettings() { ...@@ -66,6 +68,7 @@ export function useSettings() {
const updatedSettings = await ipcClient.setUserSettings(newSettings); const updatedSettings = await ipcClient.setUserSettings(newSettings);
setSettingsAtom(updatedSettings); setSettingsAtom(updatedSettings);
processSettingsForTelemetry(updatedSettings); processSettingsForTelemetry(updatedSettings);
posthog.people.set({ isPro: hasDyadProKey(updatedSettings) });
setError(null); setError(null);
return updatedSettings; return updatedSettings;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论