Skip to content

feat: add tracking for answer is we can track #4203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2018
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
3 changes: 2 additions & 1 deletion lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ export const enum TrackActionNames {
RunSetupScript = "Run Setup Script",
CheckLocalBuildSetup = "Check Local Build Setup",
CheckEnvironmentRequirements = "Check Environment Requirements",
Options = "Options"
Options = "Options",
AcceptTracking = "Accept Tracking"
}

export const AnalyticsEventLabelDelimiter = "__";
Expand Down
13 changes: 9 additions & 4 deletions lib/services/analytics/analytics-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from "path";
import { cache } from "../../common/decorators";
import { isInteractive, toBoolean } from '../../common/helpers';
import { DeviceTypes, AnalyticsClients } from "../../common/constants";
import { TrackActionNames } from "../../constants";

export class AnalyticsService implements IAnalyticsService, IDisposable {
private static ANALYTICS_BROKER_START_TIMEOUT = 10 * 1000;
Expand Down Expand Up @@ -72,10 +73,14 @@ export class AnalyticsService implements IAnalyticsService, IDisposable {
}

public async trackAcceptFeatureUsage(settings: { acceptTrackFeatureUsage: boolean }): Promise<void> {
await this.sendMessageToBroker(<IAcceptUsageReportingInformation>{
type: TrackingTypes.AcceptTrackFeatureUsage,
acceptTrackFeatureUsage: settings.acceptTrackFeatureUsage
});
const acceptTracking = !!(settings && settings.acceptTrackFeatureUsage);
const googleAnalyticsEventData: IGoogleAnalyticsEventData = {
googleAnalyticsDataType: GoogleAnalyticsDataType.Event,
action: TrackActionNames.AcceptTracking,
label: acceptTracking.toString()
};

await this.forcefullyTrackInGoogleAnalytics(googleAnalyticsEventData);
}

public async trackInGoogleAnalytics(gaSettings: IGoogleAnalyticsData): Promise<void> {
Expand Down
10 changes: 0 additions & 10 deletions lib/services/analytics/analytics.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ interface ITrackingInformation {
type: TrackingTypes
}

/**
* Describes if the user allows to be tracked.
*/
interface IAcceptUsageReportingInformation extends ITrackingInformation {
/**
* The answer of the question if user allows us to track them.
*/
acceptTrackFeatureUsage: boolean;
}

/**
* Describes information for exception that should be tracked.
*/
Expand Down