From ad437b163d494fd4b3748356c4ce6af6a2eb6c37 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 19 Nov 2025 18:39:51 +0000 Subject: [PATCH 1/3] feat: migrate PostHog client to ph.roocode.com - Update PostHog host from us.i.posthog.com to ph.roocode.com across all clients - Update webview TelemetryClient configuration - Update PostHogTelemetryClient in packages/telemetry - Update web-roo-code PostHog provider - Update .env.example with new host - Update test files to reflect new host configuration --- apps/web-roo-code/.env.example | 2 +- apps/web-roo-code/src/components/providers/posthog-provider.tsx | 2 +- packages/telemetry/src/PostHogTelemetryClient.ts | 2 +- webview-ui/src/__tests__/TelemetryClient.spec.ts | 2 +- webview-ui/src/utils/TelemetryClient.ts | 2 +- webview-ui/src/utils/__tests__/TelemetryClient.spec.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web-roo-code/.env.example b/apps/web-roo-code/.env.example index 01258bc5005..41c43e0084c 100644 --- a/apps/web-roo-code/.env.example +++ b/apps/web-roo-code/.env.example @@ -1,7 +1,7 @@ # PostHog Analytics Configuration # Replace these values with your actual PostHog API key and host NEXT_PUBLIC_POSTHOG_KEY=your_posthog_api_key_here -NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com +NEXT_PUBLIC_POSTHOG_HOST=https://ph.roocode.com # Basin Form Endpoint for Static Form Submissions # Replace this with your actual Basin form endpoint (e.g., https://usebasin.com/f/your-form-id) diff --git a/apps/web-roo-code/src/components/providers/posthog-provider.tsx b/apps/web-roo-code/src/components/providers/posthog-provider.tsx index 0d8932d549b..1a20faca022 100644 --- a/apps/web-roo-code/src/components/providers/posthog-provider.tsx +++ b/apps/web-roo-code/src/components/providers/posthog-provider.tsx @@ -55,7 +55,7 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { // Initialize PostHog with appropriate persistence based on consent posthog.init(posthogKey, { - api_host: posthogHost || "https://us.i.posthog.com", + api_host: posthogHost || "https://ph.roocode.com", capture_pageview: false, // We handle pageview tracking manually loaded: (posthogInstance) => { if (process.env.NODE_ENV === "development") { diff --git a/packages/telemetry/src/PostHogTelemetryClient.ts b/packages/telemetry/src/PostHogTelemetryClient.ts index f1c46577df5..d7f632f1379 100644 --- a/packages/telemetry/src/PostHogTelemetryClient.ts +++ b/packages/telemetry/src/PostHogTelemetryClient.ts @@ -25,7 +25,7 @@ export class PostHogTelemetryClient extends BaseTelemetryClient { debug, ) - this.client = new PostHog(process.env.POSTHOG_API_KEY || "", { host: "https://us.i.posthog.com" }) + this.client = new PostHog(process.env.POSTHOG_API_KEY || "", { host: "https://ph.roocode.com" }) } /** diff --git a/webview-ui/src/__tests__/TelemetryClient.spec.ts b/webview-ui/src/__tests__/TelemetryClient.spec.ts index 02e6ffa9740..47aadc294b0 100644 --- a/webview-ui/src/__tests__/TelemetryClient.spec.ts +++ b/webview-ui/src/__tests__/TelemetryClient.spec.ts @@ -55,7 +55,7 @@ describe("TelemetryClient", () => { expect(posthog.init).toHaveBeenCalledWith( API_KEY, expect.objectContaining({ - api_host: "https://us.i.posthog.com", + api_host: "https://ph.roocode.com", persistence: "localStorage", loaded: expect.any(Function), }), diff --git a/webview-ui/src/utils/TelemetryClient.ts b/webview-ui/src/utils/TelemetryClient.ts index 7eec16d75d7..376bb3d9d0d 100644 --- a/webview-ui/src/utils/TelemetryClient.ts +++ b/webview-ui/src/utils/TelemetryClient.ts @@ -13,7 +13,7 @@ class TelemetryClient { TelemetryClient.telemetryEnabled = true posthog.init(apiKey, { - api_host: "https://us.i.posthog.com", + api_host: "https://ph.roocode.com", persistence: "localStorage", loaded: () => posthog.identify(distinctId), capture_pageview: false, diff --git a/webview-ui/src/utils/__tests__/TelemetryClient.spec.ts b/webview-ui/src/utils/__tests__/TelemetryClient.spec.ts index 2e28994108e..516a8ef3acf 100644 --- a/webview-ui/src/utils/__tests__/TelemetryClient.spec.ts +++ b/webview-ui/src/utils/__tests__/TelemetryClient.spec.ts @@ -60,7 +60,7 @@ describe("TelemetryClient", () => { expect(posthog.init).toHaveBeenCalledWith( API_KEY, expect.objectContaining({ - api_host: "https://us.i.posthog.com", + api_host: "https://ph.roocode.com", persistence: "localStorage", loaded: expect.any(Function), }), From a72e04bcc1a0cf425a501d8c616419f1d81c45e0 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Wed, 19 Nov 2025 19:05:15 +0000 Subject: [PATCH 2/3] fix: update PostHog CSP configuration and add ui_host parameter --- apps/web-roo-code/src/components/providers/posthog-provider.tsx | 1 + src/core/webview/ClineProvider.ts | 2 +- webview-ui/src/utils/TelemetryClient.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web-roo-code/src/components/providers/posthog-provider.tsx b/apps/web-roo-code/src/components/providers/posthog-provider.tsx index 1a20faca022..67755647bdb 100644 --- a/apps/web-roo-code/src/components/providers/posthog-provider.tsx +++ b/apps/web-roo-code/src/components/providers/posthog-provider.tsx @@ -56,6 +56,7 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { // Initialize PostHog with appropriate persistence based on consent posthog.init(posthogKey, { api_host: posthogHost || "https://ph.roocode.com", + ui_host: posthogHost || "https://ph.roocode.com", capture_pageview: false, // We handle pageview tracking manually loaded: (posthogInstance) => { if (process.env.NODE_ENV === "development") { diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index c91e2e78113..ff97d5f030a 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1196,7 +1196,7 @@ export class ClineProvider - +