Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/browserView/common/browserViewTelemetry.ts
13397 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ITelemetryService } from '../../telemetry/common/telemetry.js';
7
8
/** Source of an Integrated Browser open event. */
9
export type IntegratedBrowserOpenSource =
10
/** Created via CDP, such as by the agent using Playwright tools. */
11
| 'cdpCreated'
12
/** Opened via a (non-agentic) chat tool invocation. */
13
| 'chatTool'
14
/** Opened via the "Open Integrated Browser" command without a URL argument.
15
* This typically means the user ran the command manually from the Command Palette. */
16
| 'commandWithoutUrl'
17
/** Opened via the "Open Integrated Browser" command with a URL argument.
18
* This typically means another extension or component invoked the command programmatically. */
19
| 'commandWithUrl'
20
/** Opened via the quick open feature with no initial URL. */
21
| 'quickOpenWithoutUrl'
22
/** Opened via the quick open feature with an initial URL. */
23
| 'quickOpenWithUrl'
24
/** Opened via the "New Tab" command from an existing tab. */
25
| 'newTabCommand'
26
/** Opened via the localhost link opener when the `workbench.browser.openLocalhostLinks` setting
27
* is enabled. This happens when clicking localhost links from the terminal, chat, or other sources. */
28
| 'localhostLinkOpener'
29
/** Opened when clicking a link inside the Integrated Browser that opens in a new focused editor
30
* (e.g., links with target="_blank"). */
31
| 'browserLinkForeground'
32
/** Opened when clicking a link inside the Integrated Browser that opens in a new background editor
33
* (e.g., Ctrl/Cmd+click). */
34
| 'browserLinkBackground'
35
/** Opened when clicking a link inside the Integrated Browser that opens in a new window
36
* (e.g., Shift+click). */
37
| 'browserLinkNewWindow'
38
/** Opened when the user copies a browser editor to a new window via "Copy into New Window". */
39
| 'copyToNewWindow';
40
41
type IntegratedBrowserOpenEvent = {
42
source: IntegratedBrowserOpenSource;
43
};
44
45
type IntegratedBrowserOpenClassification = {
46
source: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'How the Integrated Browser was opened' };
47
owner: 'jruales';
48
comment: 'Tracks how users open the Integrated Browser';
49
};
50
51
export function logBrowserOpen(telemetryService: ITelemetryService, source: IntegratedBrowserOpenSource): void {
52
telemetryService.publicLog2<IntegratedBrowserOpenEvent, IntegratedBrowserOpenClassification>(
53
'integratedBrowser.open',
54
{ source }
55
);
56
}
57
58