填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

收集和檢視使用情況分析

Gathering and Viewing Usage Analytics

使用者可以嘗試使用 CLI 命令 ng analyticsGoogle Analytics 上分享他們的 Angular CLI 使用情況資料。這些資料也會與 Angular 團隊共享,以改進 CLI。

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

預設情況下,CLI 會禁用分析資料的採集工作,必須由每個使用者在專案級別啟用它。它無法在專案級別對所有使用者啟用。

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

以這種方式收集的資料可以在 Google Analytics 網站上檢視,但不會自動顯示在你所屬單位的 Google Analytics 網站上。如果你是開發組織的管理員,可以配置你們的 Angular CLI 實例來檢視你的團隊在使用 Angular CLI 時的分析資料。此配置項與該使用者可能與 Google 共享的對其它使用情況的分析是彼此隔離的。

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. As 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. This configuration option is separate from and in addition to other usage analytics that your users may be sharing with Google.

允許訪問 CLI 使用情況資料

Enable access to CLI usage data

要配置對所屬使用者的 CLI 使用率資料的訪問許可權,請使用 ng config 命令在全域性 angular.json 工作區配置檔案中新增一個鍵。這個鍵位於檔案最上層的 cli.analyticsSharing 下,位於 projects 部分之外。此鍵值是你們組織的追蹤 ID,透過 Google Analytics 指定。此 ID 形如 UA-123456-12

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. The key goes under cli.analyticsSharing at the top level of the file, outside the projects sections. The value of the key is your organization's tracking ID, as assigned by Google Analytics. This ID is a string that looks like UA-123456-12.

你也可以選擇使用描述性字串作為鍵,或者在執行 CLI 命令時給它賦值一個隨機的鍵。例如,下面的命令會新增一個名為 “tracking” 的配置鍵。

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

      
      ng config --global cli.analyticsSharing.tracking UA-123456-12
    

要關閉此功能,請執行如下命令:

To turn off this feature, run the following command:

      
      ng config --global --remove cli.analyticsSharing
    

按使用者追蹤

Per user tracking

你可以在全域性配置中新增一個自訂的使用者 ID,以單獨區分命令和標誌的使用情況。如果該使用者也為自己的專案啟用了 CLI 分析,那麼分析器會分別顯示這些追蹤並標記出各自的使用情況。

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

      
      ng config --global cli.analyticsSharing.user SOME_USER_NAME
    

要產生新的隨機使用者 ID,請執行如下命令:

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

      
      ng config --global cli.analyticsSharing.user ""