Skip to content

Commit 2e6d2e1

Browse files
hanslvikerman
authored andcommitted
feat(@angular/cli): ping back when user opts out of analytics
On prompt only, does not contain any user info. Since prompt should be only shown at install or first run, this is not going to ping more than once and the users privacy is also protected.
1 parent cf86f06 commit 2e6d2e1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/angular/cli/models/analytics.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ export async function promptGlobalAnalytics(force = false) {
410410
${colors.yellow('ng analytics off')}
411411
`);
412412
console.log('');
413+
} else {
414+
// Send back a ping with the user `optout`. This is the only thing we send.
415+
const ua = new UniversalAnalytics(AnalyticsProperties.AngularCliDefault, 'optout');
416+
ua.pageview('/telemetry/optout');
417+
await ua.flush();
413418
}
414419

415420
return true;
@@ -459,6 +464,11 @@ export async function promptProjectAnalytics(force = false): Promise<boolean> {
459464
${colors.yellow('ng analytics project off')}
460465
`);
461466
console.log('');
467+
} else {
468+
// Send back a ping with the user `optout`. This is the only thing we send.
469+
const ua = new UniversalAnalytics(AnalyticsProperties.AngularCliDefault, 'optout');
470+
ua.pageview('/telemetry/project/optout');
471+
await ua.flush();
462472
}
463473

464474
return true;

0 commit comments

Comments
 (0)