Skip to content

Commit

Permalink
fix(@angular/cli): collect tech information
Browse files Browse the repository at this point in the history
Currently tech information such as OS and OS version was not being collected property due to missing required fields.

(cherry picked from commit fb19f5f)
  • Loading branch information
alan-agius4 committed Apr 3, 2023
1 parent a8376e2 commit db173d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/angular/cli/src/analytics/analytics-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export class AnalyticsCollector {
[RequestParameter.UserAgentArchitecture]: os.arch(),
[RequestParameter.UserAgentPlatform]: os.platform(),
[RequestParameter.UserAgentPlatformVersion]: os.release(),
[RequestParameter.UserAgentMobile]: 0,
[RequestParameter.SessionEngaged]: 1,
// The below is needed for tech details to be collected.
[RequestParameter.UserAgentFullVersionList]:
'Google%20Chrome;111.0.5563.64|Not(A%3ABrand;8.0.0.0|Chromium;111.0.5563.64',
};

if (ngDebug) {
Expand Down Expand Up @@ -171,6 +175,11 @@ export class AnalyticsCollector {
host: 'www.google-analytics.com',
method: 'POST',
path: '/g/collect?' + this.requestParameterStringified,
headers: {
// The below is needed for tech details to be collected even though we provide our own information from the OS Node.js module
'user-agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
},
},
(response) => {
if (response.statusCode !== 200 && response.statusCode !== 204) {
Expand Down

0 comments on commit db173d7

Please sign in to comment.