Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [12.16.2]
### Changed
- feat: update onboarding flow for Firefox ([#32179](https://github.com/MetaMask/metamask-extension/pull/32179))
- Update onboarding flow for Firefox ([#32179](https://github.com/MetaMask/metamask-extension/pull/32179))
- Make "Dapp Viewed" event exclude metametrics id data ([#32207](https://github.com/MetaMask/metamask-extension/pull/32207))

## [12.16.1]
### Added
Expand Down Expand Up @@ -5966,7 +5968,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c
- Added the ability to restore accounts from seed words.


[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.16.1...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.16.2...HEAD
[12.16.2]: https://github.com/MetaMask/metamask-extension/compare/v12.16.1...v12.16.2
[12.16.1]: https://github.com/MetaMask/metamask-extension/compare/v12.16.0...v12.16.1
[12.16.0]: https://github.com/MetaMask/metamask-extension/compare/v12.15.2...v12.16.0
[12.15.2]: https://github.com/MetaMask/metamask-extension/compare/v12.15.1...v12.15.2
Expand Down
25 changes: 15 additions & 10 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -674,18 +674,23 @@ function emitDappViewedMetricEvent(origin) {
);
const numberOfTotalAccounts = Object.keys(preferencesState.identities).length;

controller.metaMetricsController.trackEvent({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
controller.metaMetricsController.trackEvent(
{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
is_first_visit: false,
number_of_accounts: numberOfTotalAccounts,
number_of_accounts_connected: numberOfConnectedAccounts,
},
},
properties: {
is_first_visit: false,
number_of_accounts: numberOfTotalAccounts,
number_of_accounts_connected: numberOfConnectedAccounts,
{
excludeMetaMetricsId: true,
},
});
);
}

/**
Expand Down
25 changes: 15 additions & 10 deletions app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,23 @@ async function requestEthereumAccountsHandler(
const isFirstVisit = !Object.keys(metamaskState.permissionHistory).includes(
origin,
);
sendMetrics({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
sendMetrics(
{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(metamaskState.accounts).length,
number_of_accounts_connected: ethAccounts.length,
},
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(metamaskState.accounts).length,
number_of_accounts_connected: ethAccounts.length,
{
excludeMetaMetricsId: true,
},
});
);
}

res.result = ethAccounts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,23 @@ describe('requestEthereumAccountsHandler', () => {
MockUtil.shouldEmitDappViewedEvent.mockReturnValue(true);

await handler(baseRequest);
expect(sendMetrics).toHaveBeenCalledWith({
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 2,
expect(sendMetrics).toHaveBeenCalledWith(
{
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 2,
},
referrer: {
url: 'http://test.com',
},
},
referrer: {
url: 'http://test.com',
{
excludeMetaMetricsId: true,
},
});
);
});

it('does not emit the dapp viewed metrics event when shouldEmitDappViewedEvent returns false', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,18 +392,23 @@ describe('wallet_createSession', () => {
});
await handler(baseRequest);

expect(sendMetrics).toHaveBeenCalledWith({
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 4,
expect(sendMetrics).toHaveBeenCalledWith(
{
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 4,
},
referrer: {
url: 'http://test.com',
},
},
referrer: {
url: 'http://test.com',
{
excludeMetaMetricsId: true,
},
});
);
});

it('returns the session ID, properties, and session scopes', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,24 @@ async function walletCreateSessionHandler(

const approvedEthAccounts = getEthAccounts(approvedCaip25CaveatValue);

hooks.sendMetrics({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
hooks.sendMetrics(
{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(hooks.metamaskState.accounts)
.length,
number_of_accounts_connected: approvedEthAccounts.length,
},
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(hooks.metamaskState.accounts).length,
number_of_accounts_connected: approvedEthAccounts.length,
{
excludeMetaMetricsId: true,
},
});
);
}

res.result = {
Expand Down
Loading