feat: migrate all tracking calls to Segment#8387
Closed
NicolasMassart wants to merge 41 commits into
Closed
Conversation
…proxy (Batch 2 of 4) (#7520) # What is the reason for the change? - Implement a new metrics system for the Segment SDK. - Make it work alongside the old one so that we can remove the old one progressively. # What is the improvement/solution? - Create a new class to handle metrics with segment - abstract all segment SDK calls - provide our own user and anonymous Ids for improved privacy - Reuse the Mixpanel user id it available, otherwise generates a new one with the same format - patch Segment SDK to allow the privacy aware user and anonymous Ids - No event sent at all if user haven't accepted to send metrics info - Total reset of the infos in case user asks to reset (in settings) - Ability to disable all metrics - Ability to ask for deletion of all data Fixes MetaMask/mobile-planning#1222
…4) (#7990) - Initialise MetaMetrics on app start without removing Analytics yet as we still uses it outside of onboarding - create a `trackAfterInteractions` utility function to reduce code when tracking events. - Replace calls to Analytics with calls to `trackAfterInteractions` in all components involved in onboarding screens (see [`OnboardingNav`](https://github.com/MetaMask/metamask-mobile/blob/feat%2F1275_segment_onboarding_impl/app/components/Nav/App/index.js#L122-L175) in `app/components/Nav/App/index.js`) - Fix onboarding events queue usage in `app/components/UI/OptinMetrics/index.js` - Update Opt-on/Opt-out in onboarding - Extract Analytics User profil properties in UserProfileMetaData util and inject it in MetaMetrics identify request alongside device metadata Fixes MetaMask/mobile-planning#1275
- rename Segment env vars: - `SEGMENT_WRITE_KEY` - `SEGMENT_PROXY_URL` - add env var placeholders in example file Fixes missing variables naming change in MetaMask/mobile-planning#1222
…k-mobile into feat/batch_1129_segment
# Conflicts: # app/components/Views/AccountBackupStep1/index.js # app/components/Views/AccountBackupStep1B/index.js # app/components/Views/ChoosePassword/index.js # app/components/Views/ManualBackupStep1/index.js # app/components/Views/ManualBackupStep2/index.js # app/components/Views/ManualBackupStep3/index.js
# Conflicts: # app/components/Views/Settings/SecuritySettings/SecuritySettings.tsx
# Conflicts: # yarn.lock
- adds `createDataDeletionTask` to `MetaMetrics` to call the deletion API in MetaMetrics class for method [create source regulation](https://docs.segmentapis.com/tag/Deletion-and-Suppression#operation/createSourceRegulation) - adds the `checkDataDeletionTaskStatus` to `MetaMetrics` to call deletion API [get regulation method](https://docs.segmentapis.com/tag/Deletion-and-Suppression#operation/getRegulation) - calls the `createDataDeletionTask` and `checkDataDeletionTaskStatus` from `DeleteMetaMetricsData.tsx` when user touches the delete button. - extract the settings section logic to display allow deletion to a well tested hook. - Remove `Analytics.js` implementation of these features and point only to the new `MetaMetrics` ones. - update unit tests - rename in `storage.js`: - `METAMETRICS_SEGMENT_REGULATION_ID` -> `METAMETRICS_DELETION_REGULATION_ID` Fixes MetaMask/mobile-planning#1403
# Conflicts: # ios/Podfile.lock
-adds error handling on async `DefaultPreference.get` and `DefaultPreference.set` - makes building instance stronger by using the Config type to prevent config mistakes completes MetaMask/mobile-planning#1403
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. |
13 tasks
- make MetaMetrics.getInstance synchronous and add an async init function + readiness check - destructurable object hook return value to use metrics in components without having to use useRef and useEffect to set the instance - interface for the destructurable object - HOC (High Order Component) wrapper for class components - new and updated unit tests
ef6aa36 to
99194b0
Compare
remove trackAfterInteraction as now taken into account in the hook
Contributor
Author
|
Closed as this was reworked and split differently in smaller PRs for the migration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Important
This PR will be split into smaller PRs. No way I ask you to review this many files at once.
This PR is migrating all analytics events tracking calls to new Segment MetaMetrics.
There's 3 cases:
Common changes are:
InteractionManager.runAfterInteractionsas it's handled in the hook now.trackAnonymousEventwhere it was previously done by two callsAnalyticsandtrackEventV2importsFile is a class component
withMetricsAwarenessHOCthis.propsFile is a functional component
File is utils
.category)Related issues
Fixes: https://github.com/MetaMask/mobile-planning/issues/1461
Manual testing steps
Screenshots/Recordings
Before
No change with previous app behaviour
After
No change with previous app behaviour
Pre-merge author checklist
Pre-merge reviewer checklist