Disable recording webview click events (#4709)

* Disable recording webview click events

Introduces a temporary measure to disable the recording of webview click events in PostHog. This is achieved by adding a `temporaryDisabled` flag that, when true, prevents the initialization of PostHog and stops the identification of users.

This change is intended to be temporary and should be reverted in a future commit by removing the `temporaryDisabled` flag.

* Use separate PostHog config for development environment

This commit introduces a separate PostHog project for the development environment. This allows us to track events in the development environment without polluting the production data.

The `posthogConfig` now uses `posthogDevEnvConfig` when `process.env.isDev` is true, and `posthogProdConfig` otherwise.

* process.env.IS_DEV

* Update src/shared/services/config/posthog-config.ts

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* fix format

---------

Co-authored-by: Beatrix Woo <beatrix@cline.bot>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-07-15 22:46:58 -07:00
1 parent 80fbcda03b
commit cd7f3ef6a7
2 files changed
+19 -2

No files matched your search

+10 -1
View File
@@ -1,6 +1,15 @@
// Public PostHog key (safe for open source)
export const posthogConfig = {
const posthogProdConfig = {
apiKey: "phc_qfOAGxZw2TL5O8p9KYd9ak3bPBFzfjC8fy5L6jNWY7K",
host: "https://data.cline.bot",
uiHost: "https://us.posthog.com",
}
// Public PostHog key for Development Environment project
const posthogDevEnvConfig = {
apiKey: "phc_uY24EJXNBcc9kwO1K8TJUl5hPQntGM6LL1Mtrz0CBD4",
host: "https://data.cline.bot",
uiHost: "https://us.i.posthog.com",
}
export const posthogConfig = process.env.IS_DEV === "true" ? posthogDevEnvConfig : posthogProdConfig
+9 -1
View File
@@ -8,7 +8,15 @@ export function CustomPostHogProvider({ children }: { children: ReactNode }) {
const { telemetrySetting, distinctId, version } = useExtensionState()
const isTelemetryEnabled = telemetrySetting !== "disabled"
// NOTE: This is a hack to stop recording webview click events temporarily.
// Remove this to re-enable.
const temporaryDisabled = true
useEffect(() => {
if (temporaryDisabled) {
return
}
posthog.init(posthogConfig.apiKey, {
api_host: posthogConfig.host,
ui_host: posthogConfig.uiHost,
@@ -19,7 +27,7 @@ export function CustomPostHogProvider({ children }: { children: ReactNode }) {
}, [])
useEffect(() => {
if (distinctId.length === 0 || version.length === 0) {
if (temporaryDisabled || distinctId.length === 0 || version.length === 0) {
return
}