Skip to content
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

feat: add server metametrics id #24479

Closed
wants to merge 3 commits into from
Closed

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented May 10, 2024

Description

Uses an optional server metametrics ID. When set and provided, this ID will be the source of truth for metric events.
This provides better analytics for users who are logged in.

NOTE - this does not change anything really for existing users. This will (once our system enables this feature) will decrease the number of users (the same user on multiple devices).

We can have a larger discussion on this.

Related issues

Fixes:

Manual testing steps

N/A until this feature is enabled on our services.

Once this does go live:

Install 1:

  1. Use existing account with same SRP
  2. Continue onboarding, ensure that metametrics is enabled.
  3. Investigate segment calls and see which userId is sent.

Install 2:

  1. Uninstall/Reinstall or install on another browser/device
  2. Use existing account with same SRP
  3. Continue onboarding, ensure that metametrics is enabled.
  4. Investigate segment calls and see which userId is sent.
  5. Check if the userId are now the same

Screenshots/Recordings

N/A

Before

N/A

After

N/A

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've completed the PR template to the best of my ability
  • 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.

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.

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.

@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notifications team label May 14, 2024
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review May 14, 2024 10:19
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner May 14, 2024 10:19
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as draft May 14, 2024 10:22
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review May 14, 2024 11:10
* Not using the Messaging System as we
* do not want to tie this strictly to extension
*/
metametrics: MetaMetricsAuth;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As comment mentioned, we need this to be used on Mobile. Seeing that the metametrics controller is still inside the extension, my guess is that mobile uses a different approach.

@@ -904,7 +923,8 @@ export default class MetaMetricsController {
* @param {object} userTraits
*/
_identify(userTraits) {
const { metaMetricsId } = this.state;
const { metaMetricsId, serverMetaMetricsId } = this.state;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Effected Segment Events:

  • Identify
  • TrackPage
  • TrackEvent

@legobeat
Copy link
Contributor

legobeat commented May 14, 2024

Same SRP does not necessarily imply same user (best security-practices aside).

How does this distinguish one user with a new device from e.g. one user selling their private keys (delivered through SRP) to another user with a separate device, or multiple users sharing a wallet by instantiating separate devices with the same SRP?

Correlating separate users on separate devices under a single metrics ID seems problematic.

@Prithpal-Sooriya
Copy link
Contributor Author

We've had a recent discussion with the analytics team, we are now intending on using the same unique client metametrics, but just handling lineage on the back-end.

@Prithpal-Sooriya
Copy link
Contributor Author

Prithpal-Sooriya commented May 16, 2024

@legobeat

We've recently decided that we won't be using the server metametrics ID on future events (only keeping a lineage) - so will close this PR & open a new one with the relevant changes. I'll make sure to link it.

How does this distinguish one user with a new device from e.g. one user selling their private keys (delivered through SRP) to another user with a separate device, or multiple users sharing a wallet by instantiating separate devices with the same SRP?

This is a great point! I will discuss this with our team & the analytics team. Events now will still be unique, but need to keep this in mind when we store and manage the lineage/linked metametrics ids.

@Prithpal-Sooriya
Copy link
Contributor Author

Prithpal-Sooriya commented May 16, 2024

I'm closing this PR as the feature has changed from discussing with the analytics team.

A new PR (#24555) will be opened soon that does not use the server metametrics id on future events.

@github-actions github-actions bot locked and limited conversation to collaborators May 16, 2024
@legobeat legobeat deleted the feat-server-mmid branch May 16, 2024 21:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants