Skip to content

Commit 7befb4b

Browse files
committed
Adds command tracking for home
1 parent 7f6a599 commit 7befb4b

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/telemetry-events.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,17 @@ or
998998
}
999999
```
10001000

1001+
### home/command
1002+
1003+
> Sent when a Home command is executed
1004+
1005+
```typescript
1006+
{
1007+
'command': string,
1008+
'webview': string
1009+
}
1010+
```
1011+
10011012
### home/createBranch
10021013

10031014
> Sent when the user chooses to create a branch from the home view

src/constants.telemetry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
144144
/** Sent when the user changes the selected tab (mode) on the Graph Details view */
145145
'graphDetails/mode/changed': GraphDetailsModeChangedEvent;
146146

147+
/** Sent when a Home command is executed */
148+
'home/command': CommandEventData;
147149
/** Sent when the new Home view preview is toggled on/off */
148150
'home/preview/toggled': HomePreviewToggledEvent;
149151
/** Sent when the user chooses to create a branch from the home view */

src/system/vscode/command.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ export function registerCommand(command: Commands, callback: CommandCallback, th
4646
'context.mode': context?.mode,
4747
'context.submode': context?.submode,
4848
});
49+
} else if (command.startsWith('gitlens.home.')) {
50+
Container.instance.telemetry.sendEvent('home/command', {
51+
command: command,
52+
'context.mode': context?.mode,
53+
'context.submode': context?.submode,
54+
});
4955
}
5056

5157
void Container.instance.usage.track(`command:${command}:executed`).catch();
@@ -75,6 +81,11 @@ export function registerWebviewCommand(command: Commands, callback: CommandCallb
7581
command: command,
7682
webview: webview ?? '<missing>',
7783
});
84+
} else if (webview === 'gitlens.views.home' || command.startsWith('gitlens.home.')) {
85+
Container.instance.telemetry.sendEvent('home/command', {
86+
command: command,
87+
webview: webview ?? '<missing>',
88+
});
7889
}
7990

8091
void Container.instance.usage.track(`command:${command}:executed`).catch();

0 commit comments

Comments
 (0)