Skip to content

Commit f41d609

Browse files
committed
fix(@angular/cli): add unique user id as user parameter in GA
While, GA collects the user id, this cannot be used for reporting and filtering purpose. This can be
1 parent c59c1e7 commit f41d609

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

docs/design/analytics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ PROJECT NAME TO BUILD OR A MODULE NAME.**
3838
<!--USER_DIMENSIONS_TABLE_BEGIN-->
3939
| Name | Parameter | Type |
4040
|:---:|:---|:---|
41+
| UserId | `up.ng_user_id` | `string` |
4142
| OsArchitecture | `up.ng_os_architecture` | `string` |
4243
| NodeVersion | `up.ng_node_version` | `string` |
4344
| NodeMajorVersion | `upn.ng_node_major_version` | `number` |

packages/angular/cli/src/analytics/analytics-collector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export class AnalyticsCollector {
6060
// While architecture is being collect by GA as UserAgentArchitecture.
6161
// It doesn't look like there is a way to query this. Therefore we collect this as a custom user dimension too.
6262
[UserCustomDimension.OsArchitecture]: os.arch(),
63+
// While User ID is being collected by GA, this is not visible in reports/for filtering.
64+
[UserCustomDimension.UserId]: userId,
6365
[UserCustomDimension.NodeVersion]: nodeVersion,
6466
[UserCustomDimension.NodeMajorVersion]: +nodeVersion.split('.', 1)[0],
6567
[UserCustomDimension.PackageManager]: context.packageManager.name,

packages/angular/cli/src/analytics/analytics-parameters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export enum RequestParameter {
4848
* @see https://support.google.com/analytics/answer/10075209?hl=en
4949
*/
5050
export enum UserCustomDimension {
51+
UserId = 'up.ng_user_id',
5152
OsArchitecture = 'up.ng_os_architecture',
5253
NodeVersion = 'up.ng_node_version',
5354
NodeMajorVersion = 'upn.ng_node_major_version',

0 commit comments

Comments
 (0)