Skip to content

Commit 35929b6

Browse files
authored
Use identify to enhance distinct user segmentation (RooCodeInc#3765)
include backup id in front end variables clarity
1 parent ffeee7e commit 35929b6

File tree

9 files changed

+139
-214
lines changed

9 files changed

+139
-214
lines changed

.changeset/good-hounds-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Use identify to enhance distinct user segmentation

src/core/controller/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,6 @@ export class Controller {
261261
}
262262
}
263263
})
264-
265-
// If user already opted in to telemetry, enable telemetry service
266-
this.getStateToPostToWebview().then((state) => {
267-
const { telemetrySetting } = state
268-
const isOptedIn = telemetrySetting !== "disabled"
269-
telemetryService.updateTelemetryState(isOptedIn)
270-
})
271264
break
272265
case "showChatView": {
273266
this.postMessageToWebview({
@@ -786,6 +779,7 @@ export class Controller {
786779
const response = await axios.get("https://api.cline.bot/v1/mcp/marketplace", {
787780
headers: {
788781
"Content-Type": "application/json",
782+
"User-Agent": "cline-vscode-extension",
789783
},
790784
})
791785

@@ -1263,7 +1257,7 @@ export class Controller {
12631257
telemetrySetting,
12641258
planActSeparateModelsSetting,
12651259
enableCheckpointsSetting: enableCheckpointsSetting ?? true,
1266-
vscMachineId: vscode.env.machineId,
1260+
distinctId: telemetryService.distinctId,
12671261
globalClineRulesToggles: globalClineRulesToggles || {},
12681262
localClineRulesToggles: localClineRulesToggles || {},
12691263
localWindsurfRulesToggles: localWindsurfRulesToggles || {},

src/extension.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Controller } from "./core/controller"
1414
import { ErrorService } from "./services/error/ErrorService"
1515
import { initializeTestMode, cleanupTestMode } from "./services/test/TestMode"
1616
import { telemetryService } from "./services/posthog/telemetry/TelemetryService"
17+
import { v4 as uuidv4 } from "uuid"
1718

1819
/*
1920
Built using https://github.com/microsoft/vscode-webview-ui-toolkit
@@ -75,6 +76,16 @@ export async function activate(context: vscode.ExtensionContext) {
7576
console.error(`Error during post-update actions: ${errorMessage}, Stack trace: ${error.stack}`)
7677
}
7778

79+
// backup id in case vscMachineID doesn't work
80+
let installId = context.globalState.get<string>("installId")
81+
82+
if (!installId) {
83+
installId = uuidv4()
84+
await context.globalState.update("installId", installId)
85+
}
86+
87+
telemetryService.captureExtensionActivated(installId)
88+
7889
context.subscriptions.push(
7990
vscode.commands.registerCommand("cline.plusButtonClicked", async (webview: any) => {
8091
const openChat = async (instance?: WebviewProvider) => {

src/services/posthog/PostHogClientProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class PostHogClientProvider {
99
this.client = new PostHog(posthogConfig.apiKey, {
1010
host: posthogConfig.host,
1111
enableExceptionAutocapture: false,
12-
defaultOptIn: false,
1312
})
1413
}
1514

0 commit comments

Comments
 (0)