Align event logging/compliance with ml-trainer - #1303
Draft
microbit-matt-hillsdon wants to merge 4 commits into
Draft
Align event logging/compliance with ml-trainer#1303microbit-matt-hillsdon wants to merge 4 commits into
microbit-matt-hillsdon wants to merge 4 commits into
Conversation
Logging, Sentry and the shared-assets cookie consent previously lived in the private theme package. They now live here, mirroring ml-trainer's Logger + WebSink layout, with the theme package reduced to brand config plus a `product` slug injected on every event. gtag only exists on Foundation builds (VITE_FOUNDATION_BUILD), so OSS forks and local dev log events to the console; compliance falls back to a stub there so the welcome dialog still shows. Replaces the UA-shaped events and their bucketed fan-outs with flat snake_case events and primitive params, documented in docs/analytics-events.md with a migration table. Device events share ml-trainer's device_* family (task / transport / step / at_step / code) and now cover flash duration and unexpected disconnects. Project stats are sent raw as metrics, with a default_main boolean replacing the undefined-lines special case in FileSystem.statistics(). Logging.error now takes (message, e), matching the connection library, and Logging gains setUserProperty for the webusb_available user property. Adds @sentry/browser as a direct dependency. Requires @microbit-foundation/python-editor-v3-microbit 0.3.0.
Rename params so one GA4 custom definition serves both this app and ml-trainer: tab -> surface, slug/idea/sensor -> id, action -> state, default_main -> is_default, and editor_paste's lines -> count so the lines metric consistently means program length. Cuts the new dimensions to register from eight to four (format, id, is_default, state).
|
Preview build will be at |
Comment on lines
+24
to
+29
| Events go through `Logging` (`src/logging/`) and are documented in | ||
| `docs/analytics-events.md`; update the doc when adding or changing an event. | ||
| Names are snake_case with flat primitive params. gtag only exists on | ||
| Foundation builds (`VITE_FOUNDATION_BUILD`, see `index.html`), so OSS and | ||
| local dev log events to the console instead. The private theme package | ||
| supplies brand config only, including the `product` analytics slug. |
Collaborator
Author
There was a problem hiding this comment.
Suggested change
| Events go through `Logging` (`src/logging/`) and are documented in | |
| `docs/analytics-events.md`; update the doc when adding or changing an event. | |
| Names are snake_case with flat primitive params. gtag only exists on | |
| Foundation builds (`VITE_FOUNDATION_BUILD`, see `index.html`), so OSS and | |
| local dev log events to the console instead. The private theme package | |
| supplies brand config only, including the `product` analytics slug. | |
| Events go through `Logging` (`src/logging/`) and are documented in | |
| `docs/analytics-events.md`; update the doc when adding or changing an event. | |
| Names are snake_case with flat primitive params. gtag only exists on | |
| Foundation builds (`VITE_FOUNDATION_BUILD`, see `index.html`), so OSS and | |
| local dev log events to the console instead. |
Remove irrelevant note.
| @@ -0,0 +1,299 @@ | |||
| # Analytics events | |||
Collaborator
Author
There was a problem hiding this comment.
Needs recasting to be PM facing.
The event detail field feeds routerState.tab and is read as `tab` by the listener in CodeMirror.tsx, so renaming it to `surface` left the tab undefined and the API/Reference docs entry never opened. Elsewhere on this branch the internal field stays `tab` and is mapped to `surface` only at the logging.event call; do the same here. Caught by the four autocomplete e2e tests that follow the API/Help link from a completion or signature popup.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.