
- Angular CLI Tutorial
- Angular CLI - Home
- Angular CLI - Overview
- Angular CLI - Environment Setup
- Angular CLI Commands
- Angular CLI - ng version
- Angular CLI - ng new
- Angular CLI - ng help
- Angular CLI - ng generate
- Angular CLI - ng build
- Angular CLI - ng run
- Angular CLI - ng serve
- Angular CLI - ng lint
- Angular CLI - ng test
- Angular CLI - ng e2e
- Angular CLI - ng add
- Angular CLI - ng analytics
- Angular CLI - ng config
- Angular CLI - ng doc
- Angular CLI - ng update
- Angular CLI - ng xi18n
- Angular CLI - Code Coverage
- Angular CLI - ng cache Command
- Angular CLI - ng completion Command
- Angular CLI - ng deploy Command
- Angular CLI - ng extracti18n Command
- Angular CLI Useful Resources
- Angular CLI - Quick Guide
- Angular CLI - Useful Resources
- Angular CLI - Discussion
Angular CLI - ng analytics Command
This chapter will discuss the Angular CLI ng analytics command. It includes its syntax, arguments, options, and suitable examples to help you understand the real-time usage of this command in your Angular project.
The 'ng analytics' Command
The ng analytics command in the Angular CLI is used to manage the collection and usage of Angular usage analytics data. By default, Angular collects anonymous usage data to help the Angular team understand how developers are using the framework and tools. This data helps improve the framework and tools.
Syntax
Following is the syntax of the Angular CLI ng analytics command −
ng analytics [options]
Here,
- options: An optional flags (options) or arguments that control the behavior of the command.
Important! If you do not use the --help flag after this command, it might throw an error, so you are recommended to use the ng analytics --help command.
The --help option will display all the related commands that you can use for various tasks.
Arguments
The arguments for ng analytics command is as follows −
Sr.No. | Argument & Description |
---|---|
1 |
<settingOrProject>=on|off|ci|project|prompt
Directly enables or disables all usage analytics for the user, or prompts the user to set the status interactively, or sets the default status for the project. Following are the details of options.
|
2 |
<projectSetting>=on|off|prompt
Sets the default analytics enablement status for the project. |
Options
Options are optional parameters. A few commonly used options are listed below:
Sr.No. | Option & Description |
---|---|
1 |
--help=true|false|json|JSON
Shows a help message for this command in the console. Default: false |
Example
Below is an example of using the ng analytics command in an Angular project. Run the following command in your code editor terminal to see the output −
ng analytics --help
Once the above command runs successfully, the following output will be displayed in the terminal:
ng analytics Configures the gathering of Angular CLI usage metrics. Commands: ng analytics disable Disables analytics gathering and reporting for the user. [aliases: off] ng analytics enable Enables analytics gathering and reporting for the user. [aliases: on] ng analytics info Prints analytics gathering and reporting configuration in the console. ng analytics prompt Prompts the user to set the analytics gathering status interactively. Options: --help Shows a help message for this command in the console.
As you can see in the above output, you can use any of the commands to manage the collection of analytics data. The commands are:
- ng analytics disable
- ng analytics enable
- ng analytics info
- ng analytics prompt