Skip to content

Commit be89554

Browse files
committed
Sends telemetry event when an issue is opened in web browser
(#3774, #3775)
1 parent 49a96c6 commit be89554

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

docs/telemetry-events.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,22 @@ void
13581358
}
13591359
```
13601360

1361+
### startWork/issue/action
1362+
1363+
> Sent when the user takes an action on a StartWork issue
1364+
1365+
```typescript
1366+
{
1367+
'instance': number,
1368+
'type': 'branch' | 'branch-worktree' | 'issue' | 'issue-worktree',
1369+
'items.count': number,
1370+
'action': 'soft-open',
1371+
'item.id': string,
1372+
'item.type': string,
1373+
'item.provider': string
1374+
}
1375+
```
1376+
13611377
### startWork/issue/chosen
13621378

13631379
> Sent when the user chooses an issue to start work in the second step

src/constants.telemetry.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,13 @@ export type TelemetryEvents = {
324324
connected: boolean;
325325
type: StartWorkType;
326326
};
327+
/** Sent when the user takes an action on a StartWork issue */
328+
'startWork/issue/action': StartWorkEventData & {
329+
action: 'soft-open';
330+
'item.id': string;
331+
'item.type': string;
332+
'item.provider': string;
333+
};
327334
/** Sent when the user chooses an issue to start work in the second step */
328335
'startWork/issue/chosen': StartWorkEventData & {
329336
connected: boolean;

src/plus/startWork/startWork.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ export class StartWorkCommand extends QuickCommand<State> {
505505
switch (button) {
506506
case OpenOnGitHubQuickInputButton:
507507
case OpenOnJiraQuickInputButton:
508+
this.sendItemActionTelemetry('soft-open', item, context);
508509
this.open(item);
509510
return true;
510511
default:
@@ -526,6 +527,16 @@ export class StartWorkCommand extends QuickCommand<State> {
526527
void openUrl(item.item.issue.url);
527528
}
528529

530+
private sendItemActionTelemetry(action: 'soft-open', item: StartWorkItem, context: Context) {
531+
this.container.telemetry.sendEvent('startWork/issue/action', {
532+
...context.telemetryContext!,
533+
action: action,
534+
'item.id': getStartWorkItemIdHash(item),
535+
'item.type': item.item.issue.type,
536+
'item.provider': item.item.issue.provider.id,
537+
});
538+
}
539+
529540
private async getConnectedIntegrations(): Promise<Map<SupportedStartWorkIntegrationIds, boolean>> {
530541
const connected = new Map<SupportedStartWorkIntegrationIds, boolean>();
531542
await Promise.allSettled(

0 commit comments

Comments
 (0)