metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

chore: refactor metametrics events

Open NicolasMassart opened this issue 1 year ago • 1 comments

What is this about?

As MetaMetrics system evolved, we stacked multiple ways to define events. We even have a Legacy section in the events list. Even on the new events, there's multiple ways to track events because they are structured differently. This forced us to build "conversion" functions.

Scenario

No response

Design

No response

Technical Details

  • clarify the events and cleanup the list to align with extension (when possible as some events don't exist on both platforms) (see Segment tracking plan for Mobile)
  • get rid of legacy events
  • remove all legacy related code (conversion functions and tests)
  • Align mobile and extension metrics use
  • consider simplifying devs experience by having simpler function calls (see @wachunei comment https://github.com/MetaMask/metamask-mobile/pull/10545#issuecomment-2310285135)

Threat Modeling Framework

What are we working on?

  • event tracking cleanup and alignment with extension

What can go wrong?

  • too many events tracked (not enough cleanup)
  • not enough events tracked (too much cleanup)
  • data tracked when they should not be (privacy)
  • data analytics broken (dashboards and data store not updated accordingly)

What are we going to do about it?

  • sync with data team and PMs of each feature (ext and mobile)
  • clearly define the Segment tracking plan
  • write unit tests
  • review code and QA test all critical features

Did we do a good job?

  • so far yes, but we will do even better

Acceptance Criteria

  • events list clarified and simplified, consistent and cleaned our of legacy
  • all changes tested and test passes
  • events properly received and usable on the analytics side (Segment/Mixpanel)

Stakeholder review needed before the work gets merged

  • [X] Engineering (needed in most cases)
  • [ ] Design
  • [X] Product
  • [X] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • [ ] Security
  • [ ] Legal
  • [ ] Marketing
  • [ ] Management (please specify)
  • [ ] Other (please specify)

References

No response

NicolasMassart avatar Aug 23 '24 19:08 NicolasMassart

Linking this ticket here as well, to make sure that we adopt a similar approach in Extension and Mobile, whatever we agree on. https://github.com/MetaMask/mobile-planning/issues/1898

gauthierpetetin avatar Aug 26 '24 18:08 gauthierpetetin

Also related to https://github.com/MetaMask/mobile-planning/issues/1905 for aligning mobile and extension on this topic

NicolasMassart avatar Aug 30 '24 08:08 NicolasMassart

The "align mobile and extension metrics use" item has to be considered partially. We can align events and the way they are received on Segment, align prop names, ... but the two systems are very differently architectured (first because of the use of the Segment SDK on mobile), so I would not push for 100% alignment. We can align the structure of events to pass to the tracking function (the payload).

NicolasMassart avatar Sep 16 '24 17:09 NicolasMassart

That sounds reasonable to me, thanks for the analysis!

gauthierpetetin avatar Sep 17 '24 04:09 gauthierpetetin

It seems we only have to go through the cleaning and extension alignment phases!

NicolasMassart avatar Nov 27 '24 14:11 NicolasMassart

This will move forward as we plan a quest for metrics streamlining this month. Results should allow to clean the events in app. cc @bschorchit @MarioAslau

NicolasMassart avatar Dec 13 '24 11:12 NicolasMassart

It's also been about refactoring metametrics into a common controller. This is not tracked in a specific issue yet. We ahve to join effort between ext and mobile as it seems ext have something ready already.

NicolasMassart avatar Sep 09 '25 14:09 NicolasMassart