Skip to content

Commit

Permalink
fix(@angular/cli): add unique user id as user parameter in GA
Browse files Browse the repository at this point in the history
While, GA collects the user id, this cannot be used for reporting and filtering purpose. This can be
  • Loading branch information
alan-agius4 committed Oct 14, 2022
1 parent c59c1e7 commit f41d609
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/design/analytics.md
Expand Up @@ -38,6 +38,7 @@ PROJECT NAME TO BUILD OR A MODULE NAME.**
<!--USER_DIMENSIONS_TABLE_BEGIN-->
| Name | Parameter | Type |
|:---:|:---|:---|
| UserId | `up.ng_user_id` | `string` |
| OsArchitecture | `up.ng_os_architecture` | `string` |
| NodeVersion | `up.ng_node_version` | `string` |
| NodeMajorVersion | `upn.ng_node_major_version` | `number` |
Expand Down
2 changes: 2 additions & 0 deletions packages/angular/cli/src/analytics/analytics-collector.ts
Expand Up @@ -60,6 +60,8 @@ export class AnalyticsCollector {
// While architecture is being collect by GA as UserAgentArchitecture.
// It doesn't look like there is a way to query this. Therefore we collect this as a custom user dimension too.
[UserCustomDimension.OsArchitecture]: os.arch(),
// While User ID is being collected by GA, this is not visible in reports/for filtering.
[UserCustomDimension.UserId]: userId,
[UserCustomDimension.NodeVersion]: nodeVersion,
[UserCustomDimension.NodeMajorVersion]: +nodeVersion.split('.', 1)[0],
[UserCustomDimension.PackageManager]: context.packageManager.name,
Expand Down
1 change: 1 addition & 0 deletions packages/angular/cli/src/analytics/analytics-parameters.ts
Expand Up @@ -48,6 +48,7 @@ export enum RequestParameter {
* @see https://support.google.com/analytics/answer/10075209?hl=en
*/
export enum UserCustomDimension {
UserId = 'up.ng_user_id',
OsArchitecture = 'up.ng_os_architecture',
NodeVersion = 'up.ng_node_version',
NodeMajorVersion = 'upn.ng_node_major_version',
Expand Down

0 comments on commit f41d609

Please sign in to comment.