Skip to content

feat: add AuthenticationController:getUserProfileMetaMetrics new method/action#6068

Merged
mathieuartu merged 3 commits intomainfrom
feat/authentication-controller-metametrics-api
Jul 3, 2025
Merged

feat: add AuthenticationController:getUserProfileMetaMetrics new method/action#6068
mathieuartu merged 3 commits intomainfrom
feat/authentication-controller-metametrics-api

Conversation

@mathieuartu
Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu commented Jul 3, 2025

Explanation

This PR adds a new getUserProfileMetaMetrics method to AuthenticationController.
This methods queries the Authentication API and retrieves the currently authenticated user's metametrics data, in the form of UserProfileMetaMetrics type.

export type UserProfileMetaMetrics = {
  profile_id: string;
  created_at: string;
  lineage: {
    metametrics_id: string;
    agent: Platform; // 'mobile' | 'extension' | 'portfolio' | 'infura'
    created_at: string;
    updated_at: string;
    counter: number;
  }[];
};

Extension test-drive PR:

The PR above is only a demo, and shouldn't be merged.
It adds a call to getUserProfileMetaMetrics just after dispatching account syncing.

In order to view the results, switch to the test-drive PR branch, yarn, yarn start.
Then complete onboarding, open the dev tools, network tab, and filter by "authentication".
You should see a metametrics call every time you refresh the extension page (more convenient to do in full screen mode).

References

Will close:

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@mathieuartu mathieuartu self-assigned this Jul 3, 2025
@mathieuartu mathieuartu added the team-identity Identity Team changes. https://github.com/orgs/MetaMask/teams/identity label Jul 3, 2025
@mathieuartu mathieuartu changed the title feat: add AuthenticationController:getUserProfileMetaMetrics new method/action feat: add AuthenticationController:getUserProfileMetaMetrics new method/action Jul 3, 2025
@mathieuartu
Copy link
Copy Markdown
Contributor Author

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 3, 2025

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/account-tree-controller": "0.4.0-preview-83aa339c",
  "@metamask-previews/accounts-controller": "31.0.0-preview-83aa339c",
  "@metamask-previews/address-book-controller": "6.1.0-preview-83aa339c",
  "@metamask-previews/announcement-controller": "7.0.3-preview-83aa339c",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-83aa339c",
  "@metamask-previews/approval-controller": "7.1.3-preview-83aa339c",
  "@metamask-previews/assets-controllers": "70.0.0-preview-83aa339c",
  "@metamask-previews/base-controller": "8.0.1-preview-83aa339c",
  "@metamask-previews/bridge-controller": "34.0.0-preview-83aa339c",
  "@metamask-previews/bridge-status-controller": "34.0.0-preview-83aa339c",
  "@metamask-previews/build-utils": "3.0.3-preview-83aa339c",
  "@metamask-previews/chain-agnostic-permission": "1.0.0-preview-83aa339c",
  "@metamask-previews/composable-controller": "11.0.0-preview-83aa339c",
  "@metamask-previews/controller-utils": "11.10.0-preview-83aa339c",
  "@metamask-previews/delegation-controller": "0.5.0-preview-83aa339c",
  "@metamask-previews/earn-controller": "2.0.1-preview-83aa339c",
  "@metamask-previews/eip1193-permission-middleware": "1.0.0-preview-83aa339c",
  "@metamask-previews/ens-controller": "17.0.0-preview-83aa339c",
  "@metamask-previews/error-reporting-service": "2.0.0-preview-83aa339c",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-83aa339c",
  "@metamask-previews/foundryup": "1.0.0-preview-83aa339c",
  "@metamask-previews/gas-fee-controller": "24.0.0-preview-83aa339c",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-83aa339c",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-83aa339c",
  "@metamask-previews/keyring-controller": "22.1.0-preview-83aa339c",
  "@metamask-previews/logging-controller": "6.0.4-preview-83aa339c",
  "@metamask-previews/message-manager": "12.0.1-preview-83aa339c",
  "@metamask-previews/multichain-api-middleware": "1.0.0-preview-83aa339c",
  "@metamask-previews/multichain-network-controller": "0.9.0-preview-83aa339c",
  "@metamask-previews/multichain-transactions-controller": "3.0.0-preview-83aa339c",
  "@metamask-previews/name-controller": "8.0.3-preview-83aa339c",
  "@metamask-previews/network-controller": "24.0.0-preview-83aa339c",
  "@metamask-previews/notification-services-controller": "12.0.0-preview-83aa339c",
  "@metamask-previews/permission-controller": "11.0.6-preview-83aa339c",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-83aa339c",
  "@metamask-previews/phishing-controller": "12.6.0-preview-83aa339c",
  "@metamask-previews/polling-controller": "14.0.0-preview-83aa339c",
  "@metamask-previews/preferences-controller": "18.4.0-preview-83aa339c",
  "@metamask-previews/profile-sync-controller": "19.0.0-preview-83aa339c",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-83aa339c",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-83aa339c",
  "@metamask-previews/sample-controllers": "1.0.0-preview-83aa339c",
  "@metamask-previews/seedless-onboarding-controller": "1.0.0-preview-83aa339c",
  "@metamask-previews/selected-network-controller": "23.0.0-preview-83aa339c",
  "@metamask-previews/signature-controller": "31.0.0-preview-83aa339c",
  "@metamask-previews/token-search-discovery-controller": "3.3.0-preview-83aa339c",
  "@metamask-previews/transaction-controller": "58.1.0-preview-83aa339c",
  "@metamask-previews/user-operation-controller": "37.0.0-preview-83aa339c"
}

@mathieuartu mathieuartu marked this pull request as ready for review July 3, 2025 14:41
@mathieuartu mathieuartu requested review from a team as code owners July 3, 2025 14:41
cursor[bot]

This comment was marked as outdated.

dovydas55
dovydas55 previously approved these changes Jul 3, 2025
@mathieuartu mathieuartu merged commit ee5b41b into main Jul 3, 2025
211 checks passed
@mathieuartu mathieuartu deleted the feat/authentication-controller-metametrics-api branch July 3, 2025 15:04
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog team-identity Identity Team changes. https://github.com/orgs/MetaMask/teams/identity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants