-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Migrate to GA4 #24015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Migrate to GA4 #24015
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4d8768c
refactor: migrate analytics collector to use GA4
alan-agius4 92faec1
refactor: remove analytics API from core and architect
alan-agius4 cfef3d2
refactor: add build and rebuild related statistics and analytics
alan-agius4 12dbaea
refactor(@angular/cli): remove debug package from dependencies
alan-agius4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ This document list exactly what is gathered and how. | |
|
|
||
| Any change to analytics should most probably include a change to this document. | ||
|
|
||
| # Pageview | ||
| ## Pageview | ||
|
|
||
| Each command creates a pageview with the path `/command/${commandName}/${subcommandName}`. IE. | ||
| `ng generate component my-component --dryRun` would create a page view with the path | ||
|
|
@@ -16,7 +16,7 @@ Project names and target names will be removed. | |
| The command `ng run some-project:lint:some-configuration` will create a page view with the path | ||
| `/command/run`. | ||
|
|
||
| # Dimensions | ||
| ## Dimensions and Metrics | ||
|
|
||
| Google Analytics Custom Dimensions are used to track system values and flag values. These | ||
| dimensions are aggregated automatically on the backend. | ||
|
|
@@ -25,94 +25,86 @@ One dimension per flag, and although technically there can be an overlap between | |
| simplicity it should remain unique across all CLI commands. The dimension is the value of the | ||
| `x-user-analytics` field in the `schema.json` files. | ||
|
|
||
| To create a new dimension (tracking a new flag): | ||
|
|
||
| 1. Create the dimension on analytics.google.com first. Dimensions are not tracked if they aren't | ||
| defined on GA. | ||
| ### Adding dimension or metic. | ||
| 1. Create the dimension or metric in (https://analytics.google.com/)[Google Analytics] first. These are not tracked if they aren't | ||
| defined in Google Analytics. | ||
| 1. Use the ID of the dimension as the `x-user-analytics` value in the `schema.json` file. | ||
| 1. Add a new row to the table below in the same PR as the one adding the dimension to the code. | ||
| 1. New dimension PRs need to be approved by the tooling and DevRel leads. | ||
| **This is not negotiable.** | ||
| 1. New dimension and metrics PRs need to be approved by the tooling lead and require a new (http://go/launch)[Launch]. | ||
|
|
||
| ### Deleting a dimension or metic. | ||
| 1. Archive the dimension and metric in (https://analytics.google.com/)[Google Analytics]. | ||
|
|
||
|
|
||
| **DO NOT ADD `x-user-analytics` FOR VALUES THAT ARE USER IDENTIFIABLE (PII), FOR EXAMPLE A | ||
| PROJECT NAME TO BUILD OR A MODULE NAME.** | ||
|
|
||
| Note: There's a limit of 20 custom dimensions. | ||
| ### Limits | ||
| | Item | Standard property limits | | ||
| |-------------------------------- |-------------------------- | | ||
| | Event-scoped custom dimensions | 50 | | ||
| | User-scoped custom dimensions | 25 | | ||
| | All custom metrics | 50 | | ||
|
|
||
| ### List Of All Dimensions | ||
| ### List of User Custom Dimensions | ||
|
|
||
| <!--USER_DIMENSIONS_TABLE_BEGIN--> | ||
| | Name | Parameter | Type | | ||
| |:---:|:---|:---| | ||
| | Command | `ep.ng_command` | `string` | | ||
| | SchematicCollectionName | `ep.ng_schematic_collection_name` | `string` | | ||
| | SchematicName | `ep.ng_schematic_name` | `string` | | ||
| | Standalone | `ep.ng_standalone` | `string` | | ||
| | Style | `ep.ng_style` | `string` | | ||
| | Routing | `ep.ng_routing` | `string` | | ||
| | InlineTemplate | `ep.ng_inline_template` | `string` | | ||
| | InlineStyle | `ep.ng_inline_style` | `string` | | ||
| | BuilderTarget | `ep.ng_builder_target` | `string` | | ||
| | Aot | `ep.ng_aot` | `string` | | ||
| | Optimization | `ep.ng_optimization` | `string` | | ||
| <!--USER_DIMENSIONS_TABLE_END--> | ||
|
|
||
| ### List of Event Custom Dimensions | ||
|
|
||
| <!--DIMENSIONS_TABLE_BEGIN--> | ||
| | Id | Flag | Type | | ||
| | Name | Parameter | Type | | ||
| |:---:|:---|:---| | ||
| | 1 | `CPU Count` | `number` | | ||
| | 2 | `CPU Speed` | `number` | | ||
| | 3 | `RAM (In GB)` | `number` | | ||
| | 4 | `Node Version` | `number` | | ||
| | 5 | `Flag: --style` | `string` | | ||
| | 6 | `--collection` | `string` | | ||
| | 7 | `Flag: --strict` | `boolean` | | ||
| | 8 | `Angular CLI Major Version` | `string` | | ||
| | 9 | `Flag: --inline-style` | `boolean` | | ||
| | 10 | `Flag: --inline-template` | `boolean` | | ||
| | 11 | `Flag: --view-encapsulation` | `string` | | ||
| | 12 | `Flag: --skip-tests` | `boolean` | | ||
| | 13 | `Flag: --aot` | `boolean` | | ||
| | 14 | `Flag: --minimal` | `boolean` | | ||
| | 15 | `Flag: --standalone` | `boolean` | | ||
| | 16 | `Flag: --optimization` | `boolean` | | ||
| | 17 | `Flag: --routing` | `boolean` | | ||
| | 18 | `Flag: --skip-import` | `boolean` | | ||
| | 19 | `Flag: --export` | `boolean` | | ||
| | 20 | `Build Errors (comma separated)` | `string` | | ||
| | Command | `ep.ng_command` | `string` | | ||
| | SchematicCollectionName | `ep.ng_schematic_collection_name` | `string` | | ||
| | SchematicName | `ep.ng_schematic_name` | `string` | | ||
| | Standalone | `ep.ng_standalone` | `string` | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This collects only
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
| | Style | `ep.ng_style` | `string` | | ||
| | Routing | `ep.ng_routing` | `string` | | ||
| | InlineTemplate | `ep.ng_inline_template` | `string` | | ||
| | InlineStyle | `ep.ng_inline_style` | `string` | | ||
| | BuilderTarget | `ep.ng_builder_target` | `string` | | ||
| | Aot | `ep.ng_aot` | `string` | | ||
| | Optimization | `ep.ng_optimization` | `string` | | ||
| <!--DIMENSIONS_TABLE_END--> | ||
|
|
||
| # Metrics | ||
|
|
||
| ### List of All Metrics | ||
| ### List of Event Custom Metrics | ||
|
|
||
| <!--METRICS_TABLE_BEGIN--> | ||
| | Id | Flag | Type | | ||
| | Name | Parameter | Type | | ||
| |:---:|:---|:---| | ||
| | 1 | `NgComponentCount` | `number` | | ||
| | 2 | `UNUSED_2` | `none` | | ||
| | 3 | `UNUSED_3` | `none` | | ||
| | 4 | `UNUSED_4` | `none` | | ||
| | 5 | `Build Time` | `number` | | ||
| | 6 | `NgOnInit Count` | `number` | | ||
| | 7 | `Initial Chunk Size` | `number` | | ||
| | 8 | `Total Chunk Count` | `number` | | ||
| | 9 | `Total Chunk Size` | `number` | | ||
| | 10 | `Lazy Chunk Count` | `number` | | ||
| | 11 | `Lazy Chunk Size` | `number` | | ||
| | 12 | `Asset Count` | `number` | | ||
| | 13 | `Asset Size` | `number` | | ||
| | 14 | ` Polyfill Size` | `number` | | ||
| | 15 | ` Css Size` | `number` | | ||
| | AllChunksCount | `epn.ng_all_chunks_count` | `number` | | ||
| | LazyChunksCount | `epn.ng_lazy_chunks_count` | `number` | | ||
| | InitialChunksCount | `epn.ng_initial_chunks_count` | `number` | | ||
| | ChangedChunksCount | `epn.ng_changed_chunks_count` | `number` | | ||
| | DurationInMs | `epn.ng_duration_ms` | `number` | | ||
| | CssSizeInBytes | `epn.ng_css_size_bytes` | `number` | | ||
| | JsSizeInBytes | `epn.ng_js_size_bytes` | `number` | | ||
| | NgComponentCount | `epn.ng_component_count` | `number` | | ||
| <!--METRICS_TABLE_END--> | ||
|
|
||
| # Operating System and Node Version | ||
|
|
||
| A User Agent string is built to "fool" Google Analytics into reading the Operating System and | ||
| version fields from it. The base dimensions are used for those. | ||
|
|
||
| Node version is our App ID, but a dimension is also used to get the numeric MAJOR.MINOR of node. | ||
|
|
||
| # Debugging | ||
|
|
||
| Using `DEBUG=ng:analytics` will report additional information regarding initialization and | ||
| decisions made during the usage analytics process, e.g. if the user has analytics disabled. | ||
|
|
||
| Using `DEBUG=ng:analytics:command` will show the decisions made by the command runner. | ||
|
|
||
| Using `DEBUG=ng:analytics:log` will show what we actually send to GA. | ||
| ## Debugging | ||
|
|
||
| See [the `debug` NPM library](https://www.npmjs.com/package/debug) for more information. | ||
| Using `NG_DEBUG=1` will enable Google Analytics debug mode, To view the debug events, in Google Analytics go to `Configure > DebugView`. | ||
|
|
||
| # Disabling Usage Analytics | ||
| ## Disabling Usage Analytics | ||
|
|
||
| There are 2 ways of disabling usage analytics: | ||
|
|
||
| 1. using `ng analytics off --global` (or changing the global configuration file yourself). This is the same | ||
| 1. using `ng analytics disable --global` (or changing the global configuration file yourself). This is the same | ||
| as answering "No" to the prompt. | ||
| 1. There is an `NG_CLI_ANALYTICS` environment variable that overrides the global configuration. | ||
| That flag is a string that represents the User ID. If the string `"false"` is used it will | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mgechev since @dgp1130 is OOO can you please take a look the new list of data collected?