Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/mdbExtensionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ import launchMongoShell from './commands/launchMongoShell';
import type SchemaTreeItem from './explorer/schemaTreeItem';
import { StatusView } from './views';
import { StorageController, StorageVariables } from './storage';
import TelemetryService from './telemetry/telemetryService';
import TelemetryService, {
TelemetryEventTypes,
} from './telemetry/telemetryService';
import type PlaygroundsTreeItem from './explorer/playgroundsTreeItem';
import PlaygroundResultProvider from './editors/playgroundResultProvider';
import WebviewController from './views/webviewController';
Expand Down Expand Up @@ -823,7 +825,7 @@ export default class MDBExtensionController implements vscode.Disposable {
this._storageController.get(StorageVariables.GLOBAL_SURVEY_SHOWN) ===
surveyId;

// Show the overview page when it hasn't been show to the
// Show the survey when it hasn't been show to the
// user yet, and they have saved connections
// -> they haven't just started using this extension
if (
Expand All @@ -845,6 +847,13 @@ export default class MDBExtensionController implements vscode.Disposable {
);
if (result?.title === action) {
void vscode.env.openExternal(vscode.Uri.parse(link));
this._telemetryService.track(TelemetryEventTypes.SURVEY_CLICKED, {
survey_id: surveyId,
});
} else {
this._telemetryService.track(TelemetryEventTypes.SURVEY_DISMISSED, {
survey_id: surveyId,
});
}

// whether action was taken or the prompt dismissed, we won't show this again
Expand Down
9 changes: 8 additions & 1 deletion src/telemetry/telemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ type ConnectionEditedTelemetryEventProperties = {
success: boolean;
};

type SurveyActionProperties = {
survey_id: string;
};

type SavedConnectionsLoadedProperties = {
// Total number of connections saved on disk
saved_connections: number;
Expand All @@ -102,7 +106,8 @@ export type TelemetryEventProperties =
| PlaygroundSavedTelemetryEventProperties
| PlaygroundLoadedTelemetryEventProperties
| KeytarSecretsMigrationFailedProperties
| SavedConnectionsLoadedProperties;
| SavedConnectionsLoadedProperties
| SurveyActionProperties;

export enum TelemetryEventTypes {
PLAYGROUND_CODE_EXECUTED = 'Playground Code Executed',
Expand All @@ -120,6 +125,8 @@ export enum TelemetryEventTypes {
PLAYGROUND_CREATED = 'Playground Created',
KEYTAR_SECRETS_MIGRATION_FAILED = 'Keytar Secrets Migration Failed',
SAVED_CONNECTIONS_LOADED = 'Saved Connections Loaded',
SURVEY_CLICKED = 'Survey link clicked',
SURVEY_DISMISSED = 'Survey prompt dismissed',
}

/**
Expand Down