From 0eadbc49d2d23541ebb2b6baef6b49c2b0e26225 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Wed, 18 Apr 2018 23:12:34 +0300 Subject: [PATCH] fix(analytics): Message for tracking in GA is always printed In case the usage reporting is disabled, the verbose log of CLI still prints that will send information to Google Analytics. In fact it does not do it. The problem is that the message is printed before checking the state of the usage reporting. Fix this by placing the printing in the correct method. --- lib/services/analytics/analytics-service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/services/analytics/analytics-service.ts b/lib/services/analytics/analytics-service.ts index 5e24e81871..b3d02505a7 100644 --- a/lib/services/analytics/analytics-service.ts +++ b/lib/services/analytics/analytics-service.ts @@ -58,6 +58,7 @@ export class AnalyticsService extends AnalyticsServiceBase { gaSettings.customDimensions[GoogleAnalyticsCustomDimensions.client] = this.$options.analyticsClient || (isInteractive() ? AnalyticsClients.Cli : AnalyticsClients.Unknown); const googleAnalyticsData: IGoogleAnalyticsTrackingInformation = _.merge({ type: TrackingTypes.GoogleAnalyticsData, category: AnalyticsClients.Cli }, gaSettings); + this.$logger.trace("Will send the following information to Google Analytics:", googleAnalyticsData); return this.sendMessageToBroker(googleAnalyticsData); } } @@ -99,8 +100,6 @@ export class AnalyticsService extends AnalyticsServiceBase { customDimensions }; - this.$logger.trace("Will send the following information to Google Analytics:", googleAnalyticsEventData); - await this.trackInGoogleAnalytics(googleAnalyticsEventData); }