Skip to content

Conversation

@ccharly
Copy link
Contributor

@ccharly ccharly commented Feb 22, 2024

Description

Requirements:

Add more MetaMetrics events related to snap account interactions (see scenarios below).

Scenarios

Settings:

  • Account Snap Experimental Toggle On

Account menu:

  • Add account Snap button clicked

Snap account creation:

  • Create account snap confirmation seen
  • Create account Snap Cancel button clicked
  • Create account Snap Create button clicked
  • Account created confirmation seen
  • Account created confirmation ok button clicked
  • Account Snap successfully created

Snap account removal:

  • Remove account snap confirmation seen
  • Remove account Snap Cancel button clicked
  • Remove account Snap Create button clicked
  • Account removed confirmation seen
  • Account removed confirmation ok button clicked
  • Account Snap successfully removed

Snap account transactions:

  • Please complete the transaction on the Snap spinner shown
  • Finish signing with account snap confirmation shown
  • Finish signing with account Snap URL clicked
  • Finish signing with account Snap Close button clicked
  • Finish signing with account Snap Go to site button clicked

Related issues

Fixes: https://github.com/MetaMask/accounts-planning/issues/247

Manual testing steps

Start the mock-segment.js server. If you also wish to see event's content, you can use this branch to run the server first: feature/mock-segment-verbose.

Alternatively, you can "cherry-pick" the changes without the actual commit like so:
git cherry-pick -n f938d6d18cd977ba53eb68668a2d475e26b8a131

Run the server:

# With the `feature/mock-segment-verbose` changes
node development/mock-segment.js -v

# Without
node development/mock-segment.js

Then:

  1. Build and install the extension (as usual) and load it
  2. Use the SSK dapp: https://metamask.github.io/snap-simple-keyring/latest/
  3. Refers to those scenarios and "run" some of them manually using the SSK dapp and your extension

Screenshots/Recordings

snap-account-toggle.mov
add-snap-account-link.mov
create-snap-account-success.mov
create-snap-account-cancel.mov
delete-snap-account-success.mov
delete-snap-account-cancel.mov
transaction-spinner-and-go-to-site.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • 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.

@ccharly ccharly added good first issue Good for newcomers area-accounts Relating to how sensitive account data is managed and stored. area-snaps team-accounts-framework Accounts Framework team labels Feb 22, 2024
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch 3 times, most recently from 8409680 to 74ee095 Compare February 22, 2024 17:15
@ccharly ccharly removed the good first issue Good for newcomers label Feb 22, 2024
@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch 2 times, most recently from 3f4499f to 70c85c9 Compare February 22, 2024 18:06
@codecov
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 56.25000% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 68.66%. Comparing base (b110819) to head (1ab98e8).

Files Patch % Lines
app/scripts/lib/snap-keyring/snap-keyring.ts 4.76% 20 Missing ⚠️
...saction-base/confirm-transaction-base.component.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23113      +/-   ##
===========================================
- Coverage    68.70%   68.66%   -0.05%     
===========================================
  Files         1105     1105              
  Lines        43275    43330      +55     
  Branches     11570    11581      +11     
===========================================
+ Hits         29731    29749      +18     
- Misses       13544    13581      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [70c85c9]
Page Load Metrics (1736 ± 45 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1142461663115
domContentLoaded107024157
load1552191417369445
domInteractive107024157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 374 Bytes (0.01%)
  • ui: 8.93 KiB (0.13%)
  • common: 1.18 KiB (0.03%)

@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch 4 times, most recently from 3a2a16a to b292bef Compare February 26, 2024 09:22
@ccharly ccharly marked this pull request as ready for review February 26, 2024 09:40
@ccharly ccharly requested a review from a team as a code owner February 26, 2024 09:40
@metamaskbot
Copy link
Collaborator

Builds ready [b292bef]
Page Load Metrics (1807 ± 50 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1384421958340
domContentLoaded107732199
load16032100180710350
domInteractive107732199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.49 KiB (0.04%)
  • ui: 8.99 KiB (0.13%)
  • common: 1.18 KiB (0.02%)

@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch from b292bef to 46b6652 Compare February 26, 2024 09:55
@metamaskbot
Copy link
Collaborator

Builds ready [46b6652]
Page Load Metrics (1208 ± 460 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint684111378038
domContentLoaded984312110
load5429701208959460
domInteractive984312110
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.49 KiB (0.04%)
  • ui: 8.99 KiB (0.13%)
  • common: 1.18 KiB (0.02%)

origin,

// User should now see the "Successfuly added account" page
trackSnapAccountEvent(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for the reviewers:

I thought of maybe augmenting the showSuccess function (or event deeper, to the component itself) to support those events, like having a:

events: {
  onLoad: MetaMetricsEventName.AddSnapAccountSuccessViewed,
  onSubmit: MetaMetricsEventName.AddSnapAccountSuccessClicked
},

So that our component would take care "hooking" those actions and fire events automatically. But this requires a bit more effort to implement properly.

I'm also open for suggestion here, since having those metrics in the snap-keyring.ts feels a bit wrong to me.

WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this idea and I agree that the implementation would scope creep this task a bit. If you strongly feel that it should be done first then I recommend opening a new PR for that change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I'd like to move on with this PR, I'll probably keep it that way for now, and I'll leave a TODO to improve that later on.

@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch from 46b6652 to 923f5f1 Compare February 28, 2024 15:09
@danroc danroc changed the title feat(snap-keyring): more snap account metrics feat(snap-accounts): more snap account metrics Feb 29, 2024
@danroc danroc changed the title feat(snap-accounts): more snap account metrics feat(snap-keyring): more snap account metrics Feb 29, 2024
@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch 2 times, most recently from 43ba093 to 401d1bd Compare March 1, 2024 15:38
@metamaskbot
Copy link
Collaborator

Builds ready [401d1bd]
Page Load Metrics (1188 ± 525 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1015181678943
domContentLoaded1797442512
load62293811881093525
domInteractive1797442512
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1019 Bytes (0.03%)
  • ui: 4.33 KiB (0.06%)
  • common: 1.18 KiB (0.03%)

Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review notes,

  • The event Account Snap Experimental Toggle On is missing
  • The event Add Snap Account Clicked is not being triggered
  • The event Add Snap Account Cancelled is being triggered twice
  • The event Remove Snap Account Cancelled is being triggered twice
  • The event Snap Account Transaction Finalize Viewed is being triggered twice
  • Confirm if Snap Account Transaction Finalize Redirect "Go To Site" Clicked is correct when the user clicks the “Go to site” button. The metrics document says that the event should be Snap Account Transaction Finalize Closed

@ccharly the code LGTM but some events were not 100% correct and others were triggered twice, that could be because of the confirmations screens and may require a separate fix since it occurs to other unrelated confirmations too

origin,

// User should now see the "Successfuly added account" page
trackSnapAccountEvent(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this idea and I agree that the implementation would scope creep this task a bit. If you strongly feel that it should be done first then I recommend opening a new PR for that change

@montelaidev
Copy link
Contributor

It seems like SnapAccountTransactionLoadingViewed isn't loading for me when its a personal sign or sign type data

@montelaidev
Copy link
Contributor

  • The event Account Snap Experimental Toggle On is missing

The toggle events are showing up for me.

@montelaidev
Copy link
Contributor

The event AddSnapAccountClicked doesn't look like it is being used.

@montelaidev
Copy link
Contributor

Is this right? RemoveSnapAccountConfirmed doesn't get triggered if the snap account is removed from within the extension?

@ccharly
Copy link
Contributor Author

ccharly commented Mar 6, 2024

  • The event Account Snap Experimental Toggle On is missing

@gantunesr Yes, it also works for me. Did you went to the experimental tab? Also, I'm using flask "flavored" build, IDK if this is important or no?

@ccharly
Copy link
Contributor Author

ccharly commented Mar 6, 2024

The event AddSnapAccountClicked doesn't look like it is being used.

@montelaidev True! Actually I forgot to remove it, I used the same event than other account types AccountAddSelected (with the property 'account_type': 'snap')

@ccharly
Copy link
Contributor Author

ccharly commented Mar 6, 2024

@montelaidev

Is this right? RemoveSnapAccountConfirmed doesn't get triggered if the snap account is removed from within the extension?

You're right about this one. Those new events are only linked to specific snap account screens (triggered externally - outside of the extension).

I'll double check if we need to hook that "path" too. Thanks!

@ccharly ccharly requested a review from kumavis as a code owner March 6, 2024 15:48
@ccharly ccharly force-pushed the feature/247/more-snap-account-metrics branch from 7f39894 to b83cdbc Compare March 6, 2024 16:00
@gantunesr gantunesr removed the request for review from kumavis March 6, 2024 16:18
@metamaskbot
Copy link
Collaborator

Builds ready [b83cdbc]
Page Load Metrics (1328 ± 392 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint623091314924
domContentLoaded9147353014
load4920521328817392
domInteractive9147353014
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 916 Bytes (0.02%)
  • ui: 4.33 KiB (0.06%)
  • common: 1.12 KiB (0.02%)

Copy link
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [27723df]
Page Load Metrics (1461 ± 494 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint814361667737
domContentLoaded1288332210
load68300414611029494
domInteractive1288332210
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 924 Bytes (0.02%)
  • ui: 4.33 KiB (0.06%)
  • common: 1.12 KiB (0.02%)

@metamaskbot
Copy link
Collaborator

Builds ready [1ab98e8]
Page Load Metrics (1081 ± 486 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint772511395325
domContentLoaded127632199
load63274210811012486
domInteractive127632199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 924 Bytes (0.02%)
  • ui: 4.33 KiB (0.06%)
  • common: 1.12 KiB (0.02%)

@ccharly ccharly merged commit 3423aab into develop Mar 7, 2024
@ccharly ccharly deleted the feature/247/more-snap-account-metrics branch March 7, 2024 14:04
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2024
@metamaskbot metamaskbot added the release-11.14.0 Issue or pull request that will be included in release 11.14.0 label Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-accounts Relating to how sensitive account data is managed and stored. area-snaps release-11.14.0 Issue or pull request that will be included in release 11.14.0 team-accounts-framework Accounts Framework team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants