-
-
Notifications
You must be signed in to change notification settings - Fork 261
Feat(analytics): new analytics controller [Phase 1.1] #7017
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
Conversation
…ific code - Remove platform identifier from state and adapter interface - Remove AnalyticsEventOptions (isOptIn, excludeFromMetrics) - Remove eventsTracked counter from state - Consolidate enable/disable into setEnabled(enabled?: boolean) with default true - Make setOptedIn accept optional parameter with default true - Make all tracking methods synchronous (remove Promise<void>) - Update messenger type to follow pattern with AllowedActions/AllowedEvents - Update BaseController to use literal 'AnalyticsController' type - Simplify README to minimal format matching other controllers
mcmire
left a comment
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.
I know this is in draft but I couldn't help but review this now :)
… method exposure - Add MESSENGER_EXPOSED_METHODS for automatic method action handlers - Generate method action types using generate-method-action-types - Consolidate types into controller file (state, messenger, actions) - Rename types.ts to more specific AnalyticsPlatformAdapter.types.ts - Update test helper from withController to setupController - Match file organization pattern used in sample-controllers
…of truth and auto-generate UUIDv4 analyticsId
inline object Co-authored-by: Guillaume Roux <[email protected]>
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
…Mask/core into feat/21854_new_analytics_controller
82556b0 to
e5e7db2
Compare
mcmire
left a comment
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.
LGTM!
There was a new package added in #7017 that had no entry in `teams.json`. It has been added.
There was a new package added in #7017 that had no entry in `teams.json`. It has been added.
## Explanation There was a new package added in #7017 that had no entry in `teams.json`. It has been added. ## References Related to #7017 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit bcb720f. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Explanation
New
@metamask/analytics-controllerpackage for unified, platform-agnostic analytics tracking controller for MetaMask.This controller is designed for both the extension and mobile.
Changes
Important
The adapter type is work in progress and will be updated as we
integrate with the new analytics system on mobile.
We have this draft type to help us iterate on the implementation.
It will be updated with proper types as we create the mobile adapter
And the controller package will be released only when this is completed.
Mobile side tests
Implemented the controller as a local resolution with

"@metamask/analytics-controller@^1.0.0": "file:../core/packages/analytics-controller",and all the init process.
It loads well.
Mobile not ready yet to PR as controller is not published.
References
fixes MetaMask/metamask-mobile#21854
Mobile PR MetaMask/metamask-mobile#22076
Checklist
Note
Introduces
@metamask/analytics-controllerwith event/page tracking, user identification, state/messenger integration, tests/docs, and repo wiring.@metamask/analytics-controllerAnalyticsControllerwith methodstrackEvent,identify,trackPage,enable/disable,optIn/optOut; default state viagetDefaultAnalyticsControllerState()(UUIDv4analyticsId).AnalyticsPlatformAdapterand action types (AnalyticsController-*-action-types).AnalyticsController:*.package.json,jest.config.js(100% coverage thresholds),tsconfig/build configs,typedoc,CHANGELOG.md, licenses, README with usage.README.md(list + mermaid graph),.github/CODEOWNERS,tsconfig.json,tsconfig.build.json, andyarn.lock.Written by Cursor Bugbot for commit a631fb0. This will update automatically on new commits. Configure here.