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(882): Optimize metrics function usage during onboarding flow #20101

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

DDDDDanica
Copy link
Contributor

@DDDDDanica DDDDDanica commented Jul 19, 2023

Explanation

Only start trackEvent method on ui/pages/onboarding-flow/welcome/welcome.js when user opts in metrics track on onboarding.

Screenshots/Screencaps

Before

Send metric events

before.mov

After

Will not send metric events if not opting in

after.mov

Manual Testing Steps

  • Open network tab when onboarding
  • Check if there's any batch request to send metrics

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@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.

*/
const onboardingChooseMetametricsOption = async (driver, optin = false) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo fix

* @returns {import('mockttp/dist/pluggable-admin').MockttpClientResponse[]}
*/
async function getEventPayloads(driver, mockedEndpoints) {
async function getEventPayloads(driver, mockedEndpoints, hasRequest = true) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expand method to test no request scenario as well

@@ -43,28 +44,6 @@ async function mockSegment(mockServer) {
];
}

/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Duplicated in helper.js

const FixtureBuilder = require('../fixture-builder');

describe('Segment metrics', function () {
describe('Unlock wallet', function () {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move to metrics folder

},
);
});
});

function assertBatchValue(mockRequest, assertedTitle, assertedPath) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor to make it more readable

@danjm danjm changed the title feat(882): Ensure user's IP address is not leaked to third parties before opting-out feat(882): Optimize metrics function usage during onboarding flow Jul 19, 2023
Copy link
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

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

Nice work!

@pedronfigueiredo
Copy link
Contributor

LGTM!

@DDDDDanica DDDDDanica merged commit cc3ef53 into develop Jul 19, 2023
12 checks passed
@DDDDDanica DDDDDanica deleted the feature/882 branch July 19, 2023 19:56
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2023
@metamaskbot metamaskbot added the release-10.36.0 Issue or pull request that will be included in release 10.36.0 label Jul 19, 2023
@Gudahtt Gudahtt added release-11.1.0 Issue or pull request that will be included in release 11.1.0 and removed release-10.36.0 Issue or pull request that will be included in release 10.36.0 labels Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.1.0 Issue or pull request that will be included in release 11.1.0 team-extension-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants