當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript defaultClient.trackEvent方法代碼示例

本文整理匯總了TypeScript中applicationinsights.defaultClient.trackEvent方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript defaultClient.trackEvent方法的具體用法?TypeScript defaultClient.trackEvent怎麽用?TypeScript defaultClient.trackEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在applicationinsights.defaultClient的用法示例。


在下文中一共展示了defaultClient.trackEvent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: trackCustomEvent

export function trackCustomEvent (eventName: string, trackingProperties: {}) {
  try {
    if (appInsights.defaultClient) {
      appInsights.defaultClient.trackEvent({
        name: eventName,
        properties: trackingProperties
      })
    }
  } catch (err) {
    logger.logError(err.stack)
  }
}
開發者ID:hmcts,項目名稱:cmc-citizen-frontend,代碼行數:12,代碼來源:customEventTracker.ts

示例2: Promise

	return new Promise(resolve => {
		try {

			const sizes: any = {};
			const counts: any = {};
			for (const entry of sorted) {
				sizes[entry.name] = entry.totalSize;
				counts[entry.name] = entry.totalCount;
			}

			appInsights.setup(productJson.aiConfig.asimovKey)
				.setAutoCollectConsole(false)
				.setAutoCollectExceptions(false)
				.setAutoCollectPerformance(false)
				.setAutoCollectRequests(false)
				.setAutoCollectDependencies(false)
				.setAutoDependencyCorrelation(false)
				.start();

			appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';

			/* __GDPR__
				"monacoworkbench/packagemetrics" : {
					"commit" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
					"size" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" },
					"count" : {"classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
				}
			*/
			appInsights.defaultClient.trackEvent({
				name: 'monacoworkbench/packagemetrics',
				properties: { commit, size: JSON.stringify(sizes), count: JSON.stringify(counts) }
			});


			appInsights.defaultClient.flush({
				callback: () => {
					appInsights.dispose();
					resolve(true);
				}
			});

		} catch (err) {
			console.error('ERROR sending build stats as telemetry event!');
			console.error(err);
			resolve(false);
		}
	});
開發者ID:PKRoma,項目名稱:vscode,代碼行數:47,代碼來源:stats.ts

示例3: Promise

	return new Promise(resolve => {

		const measurements = Object.create(null);
		for (const entry of sorted) {
			measurements[`${entry.name}.size`] = entry.totalSize;
			measurements[`${entry.name}.count`] = entry.totalCount;
		}

		appInsights.setup(productJson.aiConfig.asimovKey)
			.setAutoCollectConsole(false)
			.setAutoCollectExceptions(false)
			.setAutoCollectPerformance(false)
			.setAutoCollectRequests(false)
			.start();

		appInsights.defaultClient.config.endpointUrl = 'https://vortex.data.microsoft.com/collect/v1';
		appInsights.defaultClient.trackEvent(`bundleStats`, undefined, measurements);
		appInsights.defaultClient.sendPendingData(() => resolve());
	});
開發者ID:developers23,項目名稱:vscode,代碼行數:19,代碼來源:stats.ts


注:本文中的applicationinsights.defaultClient.trackEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。