Add telemetry to identify internal users (#463)
* Add telemetry to identify internal users
This commit is contained in:
Родитель
842c403b7f
Коммит
010d313fbe
|
@ -174,6 +174,8 @@ export class Constants {
|
|||
public static openSampleEvent = "openSample";
|
||||
public static openSampleUrlEvent = "openSampleUrl";
|
||||
|
||||
public static isInternalPropertyName = "isInternal";
|
||||
|
||||
public static subModuleKeyPrefixTemplate(name: string): string {
|
||||
return `MODULES.${name}`;
|
||||
}
|
||||
|
|
|
@ -12,8 +12,22 @@ const aiKey: string = packageJSON.aiKey;
|
|||
|
||||
export class TelemetryClient {
|
||||
public static sendEvent(eventName: string, properties?: { [key: string]: string; }): void {
|
||||
if (properties) {
|
||||
properties[Constants.isInternalPropertyName] = this._isInternal === true ? "true" : "false";
|
||||
} else {
|
||||
properties = {
|
||||
[Constants.isInternalPropertyName] : this._isInternal === true ? "true" : "false",
|
||||
};
|
||||
}
|
||||
this._client.sendTelemetryEvent(eventName, properties);
|
||||
}
|
||||
|
||||
private static _isInternal: boolean = TelemetryClient.isInternalUser();
|
||||
|
||||
private static _client = new TelemetryReporter(Constants.ExtensionId, extensionVersion, aiKey);
|
||||
|
||||
private static isInternalUser(): boolean {
|
||||
const userDomain = process.env.USERDNSDOMAIN ? process.env.USERDNSDOMAIN.toLowerCase() : "";
|
||||
return userDomain.endsWith("microsoft.com");
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче