diff --git a/src/extension.ts b/src/extension.ts index ec43a39..b27e2f5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as cp from 'child_process'; import * as util from 'util'; import * as path from 'path'; -import html from './ui'; +import getHtml from './ui'; const exec = util.promisify(cp.exec); @@ -2136,7 +2136,7 @@ class ClaudeChatProvider { } private _getHtmlForWebview(): string { - return html; + return getHtml(vscode.env?.isTelemetryEnabled); } private _sendCurrentSettings(): void { diff --git a/src/ui.ts b/src/ui.ts index 3116f83..855f097 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -1,5 +1,5 @@ import styles from './ui-styles' -const html = ` +const getHtml = (isTelemetryEnabled: boolean) => ` @@ -1470,13 +1470,15 @@ const html = ` // Send usage statistics function sendStats(eventName) { - try { + ${isTelemetryEnabled ? + `try { if (typeof umami !== 'undefined' && umami.track) { umami.track(eventName); } } catch (error) { console.error('Error sending stats:', error); - } + }` : + `// Telemetry disabled - no tracking`} } function updateStatus(text, state = 'ready') { @@ -3669,8 +3671,8 @@ const html = ` 2. Do I need to display a cookie notice to users? No, Umami does not use any cookies in the tracking code. --> - + ${isTelemetryEnabled ? '' : ''} `; -export default html; \ No newline at end of file +export default getHtml; \ No newline at end of file