@@ -22,6 +22,28 @@ const analyticsLogDebug = debug('ng:analytics:log'); // Actual logs of events.
22
22
23
23
const BYTES_PER_MEGABYTES = 1024 * 1024 ;
24
24
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
+
25
47
/**
26
48
* This is the ultimate safelist for checking if a package name is safe to report to analytics.
27
49
*/
@@ -467,7 +489,7 @@ export function hasGlobalAnalyticsConfiguration(): boolean {
467
489
*/
468
490
export function getGlobalAnalytics ( ) : UniversalAnalytics | undefined {
469
491
analyticsDebug ( 'getGlobalAnalytics' ) ;
470
- const propertyId = 'UA-8594346-29' ;
492
+ const propertyId = AnalyticsProperties . AngularCliDefault ;
471
493
472
494
if ( 'NG_CLI_ANALYTICS' in process . env ) {
473
495
if ( process . env [ 'NG_CLI_ANALYTICS' ] == 'false' || process . env [ 'NG_CLI_ANALYTICS' ] == '' ) {
0 commit comments