From ee19904b291eaf8bc7caa5f02ca4582fac6e6803 Mon Sep 17 00:00:00 2001 From: "roomote[bot]" <219738659+roomote[bot]@users.noreply.github.com> Date: Wed, 19 Nov 2025 14:44:22 -0500 Subject: [PATCH] feat: migrate PostHog client to ph.roocode.com (#9402) Co-authored-by: Roo Code Co-authored-by: Matt Rubens --- apps/web-roo-code/.env.example | 1 - .../src/components/providers/posthog-provider.tsx | 11 ++--------- packages/telemetry/src/PostHogTelemetryClient.ts | 2 +- src/core/webview/ClineProvider.ts | 2 +- src/core/webview/__tests__/ClineProvider.spec.ts | 2 +- webview-ui/src/__tests__/TelemetryClient.spec.ts | 2 +- webview-ui/src/utils/TelemetryClient.ts | 3 ++- .../src/utils/__tests__/TelemetryClient.spec.ts | 2 +- 8 files changed, 9 insertions(+), 16 deletions(-) diff --git a/apps/web-roo-code/.env.example b/apps/web-roo-code/.env.example index 01258bc500..c5e8726df1 100644 --- a/apps/web-roo-code/.env.example +++ b/apps/web-roo-code/.env.example @@ -1,7 +1,6 @@ # 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 # 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 0d8932d549..29e2fca933 100644 --- a/apps/web-roo-code/src/components/providers/posthog-provider.tsx +++ b/apps/web-roo-code/src/components/providers/posthog-provider.tsx @@ -32,7 +32,6 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { // Initialize PostHog immediately on the client side if (typeof window !== "undefined" && !posthog.__loaded) { const posthogKey = process.env.NEXT_PUBLIC_POSTHOG_KEY - const posthogHost = process.env.NEXT_PUBLIC_POSTHOG_HOST // Check if environment variables are set if (!posthogKey) { @@ -43,19 +42,13 @@ export function PostHogProvider({ children }: { children: React.ReactNode }) { return } - if (!posthogHost) { - console.warn( - "PostHog host URL is missing. Using default host. " + - "Please set NEXT_PUBLIC_POSTHOG_HOST in your .env file.", - ) - } - // Check if user has already consented to cookies const userHasConsented = hasConsent() // Initialize PostHog with appropriate persistence based on consent posthog.init(posthogKey, { - api_host: posthogHost || "https://us.i.posthog.com", + api_host: "https://ph.roocode.com", + ui_host: "https://us.posthog.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 f1c46577df..d7f632f137 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/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index c91e2e7811..ff97d5f030 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -1196,7 +1196,7 @@ export class ClineProvider - +