@@ -22,6 +22,28 @@ const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
2222
2323const BYTES_PER_MEGABYTES = 1024 * 1024 ;
2424
25+ let _defaultAngularCliPropertyCache : string ;
26+ export const AnalyticsProperties = {
27+ AngularCliProd : 'UA-8594346-29' ,
28+ AngularCliStaging : 'UA-8594346-32' ,
29+ get AngularCliDefault ( ) : string {
30+ if ( _defaultAngularCliPropertyCache ) {
31+ return _defaultAngularCliPropertyCache ;
32+ }
33+
34+ const v = require ( '../package.json' ) . version ;
35+
36+ // The logic is if it's a full version then we should use the prod GA property.
37+ if ( / ^ \d + \. \d + \. \d + $ / . test ( v ) && v !== '0.0.0' ) {
38+ _defaultAngularCliPropertyCache = AnalyticsProperties . AngularCliProd ;
39+ } else {
40+ _defaultAngularCliPropertyCache = AnalyticsProperties . AngularCliStaging ;
41+ }
42+
43+ return _defaultAngularCliPropertyCache ;
44+ } ,
45+ } ;
46+
2547/**
2648 * This is the ultimate safelist for checking if a package name is safe to report to analytics.
2749 */
@@ -467,7 +489,7 @@ export function hasGlobalAnalyticsConfiguration(): boolean {
467489 */
468490export function getGlobalAnalytics ( ) : UniversalAnalytics | undefined {
469491 analyticsDebug ( 'getGlobalAnalytics' ) ;
470- const propertyId = 'UA-8594346-29' ;
492+ const propertyId = AnalyticsProperties . AngularCliDefault ;
471493
472494 if ( 'NG_CLI_ANALYTICS' in process . env ) {
473495 if ( process . env [ 'NG_CLI_ANALYTICS' ] == 'false' || process . env [ 'NG_CLI_ANALYTICS' ] == '' ) {
0 commit comments