LinuxCommandLibrary

ng-analytics

TLDR

Enable analytics for the current project

$ ng analytics [[on|enable]]
copy

Enable analytics globally
$ ng analytics [[on|enable]] [[-g|--global]]
copy

Disable analytics for the current project
$ ng analytics [[off|disable]]
copy

Disable analytics globally
$ ng analytics [[off|disable]] [[-g|--global]]
copy

Display the current analytics configuration and status
$ ng analytics info
copy

Prompt interactively to configure analytics settings
$ ng analytics prompt
copy

SYNOPSIS

ng analytics [on|off]

PARAMETERS

on
    Enables Angular CLI analytics sharing

off
    Disables Angular CLI analytics sharing

--help, -h
    Displays help for the command

--verbose
    Enables verbose logging (global ng option)

DESCRIPTION

The ng analytics command configures whether the Angular CLI shares anonymous usage data with the Angular team via Google Analytics. This helps improve the CLI by tracking common commands, errors, and features used.

By default, analytics is disabled to respect user privacy. Running ng analytics without arguments displays the current status (enabled or disabled). Use on to opt-in, sending data like command invocations, project sizes, and dependency versions. Data is anonymized—no personal info, IPs, or project names are collected.

This feature was added to gather insights ethically. Opting in contributes to Angular's development; opting out ensures no data sharing. Changes are stored in the global Angular CLI configuration file (~/.angular-cli.json or similar).

Note: Requires Node.js/npm and Angular CLI installation via npm install -g @angular/cli. Analytics transmission occurs on CLI usage, not affecting app builds.

CAVEATS

Analytics data sent only if enabled and internet available. No data collected on opt-out. Global config overrides local; check with ng config cli.analytics. Not available in all CLI versions pre-v6.

STATUS CHECK

Run ng analytics alone to view current status: Analytics: false or true.

CONFIG ALTERNATIVE

Set via config: ng config cli.analytics true or false.

HISTORY

Introduced in Angular CLI v6 (May 2018) amid privacy concerns, replacing implicit tracking. Evolved with CLI updates; v12+ refined data collection for better insights while maintaining opt-in model.

SEE ALSO

ng(1), ng config(1), npm(1)

Copied to clipboard