{ "id": "cli/usage-analytics-gathering", "title": "Gathering and Viewing Usage Analytics", "contents": "\n\n\n
\n mode_edit\n
\n\n\n
\n

Gathering and Viewing Usage Analyticslink

\n

Users can opt in to share their Angular CLI usage data with Google Analytics, using the ng analytics CLI command.\nThe data is also shared with the Angular team, and used to improve the CLI.

\n

The gathering of CLI analytics data is disabled by default, and must be enabled at the project level by individual users.\nIt cannot be enabled at the project level for all users.

\n

Data gathered in this way can be viewed on the Google Analytics site, but is not automatically visible on your own organization's Analytics site.\nAs an administrator for an Angular development group, you can configure your instance of Angular CLI to be able to see analytics data for your own team's usage of the Angular CLI.\nThis configuration option is separate from and in addition to other usage analytics that your users may be sharing with Google.

\n

Enable access to CLI usage datalink

\n

To configure access to your own users' CLI usage data, use the ng config command to add a key to your global angular.json workspace configuration file.\nThe key goes under cli.analyticsSharing at the top level of the file, outside the projects sections.\nThe value of the key is your organization's tracking ID, as assigned by Google Analytics.\nThis ID is a string that looks like UA-123456-12.

\n

You can choose to use a descriptive string as the key value, or be assigned a random key when you run the CLI command.\nFor example, the following command adds a configuration key named \"tracking\".

\n\nng config --global cli.analyticsSharing.tracking UA-123456-12\n\n

To turn off this feature, run the following command:

\n\nng config --global --remove cli.analyticsSharing\n\n

Per user trackinglink

\n

You can add a custom user ID to the global configuration, in order to identify unique usage of commands and flags.\nIf that user enables CLI analytics for their own project, your analytics display tracks and labels their individual usage.

\n\nng config --global cli.analyticsSharing.user SOME_USER_NAME\n\n

To generate a new random user ID, run the following command:

\n\nng config --global cli.analyticsSharing.user \"\"\n\n\n \n
\n\n\n" }