angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Suggestions for Analytics Sharing #21916

Closed henry-alakazhang closed 3 years ago

henry-alakazhang commented 3 years ago

🚀 Feature request

Command

Description

Hey all, I'm trying to set up analytics sharing to get some local build timings from the engineers in my org. It's quite cool and has the potential to be very useful, but I ran into a few issues:

🐞 Bug (ng config) - The JSON schema for cli.analyticsSharing.tracking is wrong/overly restrictive

It currently enforces tracking IDs start with GA-, whereas my tracking ID is UA-XXXXX-X (and indeed the docs give a UA- tracking ID as an example). Google Analytics 4 has fully numeric IDs as well.

📚 Docs - https://angular.io/cli/usage-analytics-gathering#per-user-tracking is out of date

It mentions per-user tracking and makes it seem optional, but it's not actually optional - shared tracking doesn't run if user is unset. The field is also uuid, and not user like the docs say. It's also not actually possible to disable the tracking via ng config, as --remove doesn't exist anymore and schema validation prevents setting to undefined/null.

🚀 Feature request - report AOT as a custom dimension like Ivy (and not just a CLI flag)

https://github.com/angular/angular-cli/blob/master/docs/design/analytics.md suggests that usage of the --aot flag is passed to pageview analytics. I'm not sure if this is actually usable anymore due to changes to the CLI, but either way - it would be nice if all reporting (especially build timing events) could report AOT status.

Specifically, we have configurations (rather than flags) that allow developers to disable AOT for speed, which obviously results in dramatically different build/rebuild times, and splitting by AOT would make the data more useful.

I should probably make separate issues. Please let me know if that would be better.

alan-agius4 commented 3 years ago

Hi @henry-alakazhang,

Thanks for opening this issue.

🐞 Bug (ng config) - The JSON schema for cli.analyticsSharing.tracking is wrong/overly restrictive

Can confirm that this is a bug which needs to be amended. (Will try to address this today), Note: we only support Google Analytics API version 1.

📚 Docs - https://angular.io/cli/usage-analytics-gathering#per-user-tracking is out of date

The docs are indeed out of date . (Will try to address this today). To unset a field you can use ng config cli.analyticsSharing.uuid undefined.

🚀 Feature request - report AOT as a custom dimension like Ivy (and not just a CLI flag)

The aot flag is still a usable matrix, since users can still use JIT compilations. I think adding the AOT as dimension in the build and rebuild events would also be useful to use. //cc @mgechev what do you think? would you also find this useful from your end?

henry-alakazhang commented 3 years ago

Thanks for the fast reply!

📚 Docs - https://angular.io/cli/usage-analytics-gathering#per-user-tracking is out of date

The docs are indeed out of date . (Will try to address this today). To unset a field you can use ng config cli.analyticsSharing.uuid undefined.

I can update these if you would like, though I guess I don't know the intended usage of some parts.

The suggested command doesn't actually work - it sets the field to the string "undefined", which is accepted by the CLI. universal-analytics then reports Invalid UUID format and defaults it to a generated one.

🚀 Feature request - report AOT as a custom dimension like Ivy (and not just a CLI flag)

The aot flag is still a usable matrix, since users can still use JIT compilations.

My mistake, must have conflated something odd with our workspace with something that was done by the CLI. It would be nice if it could check it from the build context, as it would allow configuration-based AOT/JIT toggline to also be tracked. Unless I've misunderstood the existing code lol. Though we can always just pass the param even if it's overwritten by the config.

alan-agius4 commented 3 years ago

I can update these if you would like, though I guess I don't know the intended usage of some parts.

Thanks for the offer, although now I am almost done with the changes :)

The suggested command doesn't actually work - it sets the field to the string "undefined", which is accepted by the CLI. universal-analytics then reports Invalid UUID format and defaults it to a generated one.

Undefined needs to be passed without it being wrapped in quotes, like the below

ng config cli.analyticsSharing.uuid undefined
henry-alakazhang commented 3 years ago

Undefined needs to be passed without it being wrapped in quotes, like the below

ng config cli.analyticsSharing.uuid undefined

Ah yeah my bad, it's because I was using yarn to run the workspace ng and it was wrapping everything weirdly. undefined does indeed work.

alan-agius4 commented 3 years ago

The first two items have been addressed via https://github.com/angular/angular-cli/pull/21919 and https://github.com/angular/angular/pull/43795

alan-agius4 commented 3 years ago

List pending item has been addressed in https://github.com/angular/angular-cli/pull/21929.

angular-automatic-lock-bot[bot] commented 3 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.