Skip to content

Commit 0dd8819

Browse files
author
Fatme
authored
Merge pull request #4185 from NativeScript/fatme/track-code-sharing
feat(analytics): track code sharing projects usage
2 parents 9a5b927 + 011d2ef commit 0dd8819

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

lib/common/services/analytics/google-analytics-custom-dimensions.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ declare const enum GoogleAnalyticsCustomDimensions {
66
client = "cd5",
77
nodeVersion = "cd6",
88
playgroundId = "cd7",
9-
usedTutorial = "cd8"
9+
usedTutorial = "cd8",
10+
isShared = "cd9"
1011
}

lib/definitions/project.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ interface IProjectService {
7373
interface INsConfig {
7474
appPath?: string;
7575
appResourcesPath?: string;
76+
shared?: boolean;
7677
}
7778

7879
interface IProjectData extends ICreateProjectData {

lib/services/analytics/analytics-service.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export class AnalyticsService implements IAnalyticsService, IDisposable {
118118
if (data.projectDir) {
119119
const projectData = this.$projectDataService.getProjectData(data.projectDir);
120120
customDimensions[GoogleAnalyticsCustomDimensions.projectType] = projectData.projectType;
121+
const isShared = projectData.nsConfig ? (projectData.nsConfig.shared || false) : false;
122+
customDimensions[GoogleAnalyticsCustomDimensions.isShared] = isShared.toString();
121123
}
122124

123125
const googleAnalyticsEventData: IGoogleAnalyticsEventData = {

lib/services/analytics/google-analytics-provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class GoogleAnalyticsProvider implements IGoogleAnalyticsProvider {
6969
[GoogleAnalyticsCustomDimensions.nodeVersion]: process.version,
7070
[GoogleAnalyticsCustomDimensions.clientID]: this.clientId,
7171
[GoogleAnalyticsCustomDimensions.projectType]: null,
72+
[GoogleAnalyticsCustomDimensions.isShared]: null,
7273
[GoogleAnalyticsCustomDimensions.sessionID]: sessionId,
7374
[GoogleAnalyticsCustomDimensions.client]: AnalyticsClients.Unknown
7475
};

0 commit comments

Comments
 (0)