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

fix: ensure marketing consent is explicitly tracked as boolean #12926

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

jonybur
Copy link
Contributor

@jonybur jonybur commented Jan 10, 2025

Description

Currently, when users decline marketing consent during onboarding, the has_marketing_consent property is not being set at all in the analytics. This creates inconsistent data where we can't properly track users who explicitly opted out of marketing.

This PR modifies the OptinMetrics component to explicitly set has_marketing_consent to either true or false based on the user's choice, ensuring we have complete analytics data for all user decisions regarding marketing consent.

Related issues

Fixes: https://github.com/MetaMask/mobile-planning/issues/2086

Manual testing steps

  1. Fresh install the app
  2. Go through onboarding until you reach the "Help us improve MetaMask" screen
  3. Test both scenarios:
    • Accept metrics but decline marketing consent checkbox
    • Accept both metrics and marketing consent
  4. Verify in analytics that has_marketing_consent is properly set to false in first case and true in second case

Screenshots/Recordings

Before

Analytics data missing has_marketing_consent property when user declines marketing consent

After

Analytics data showing explicit has_marketing_consent: false when user declines marketing consent

Pre-merge author checklist

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.

@jonybur jonybur added the Run Smoke E2E Triggers smoke e2e on Bitrise label Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 87e744c
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/a011f1e6-bdcd-4020-acba-ec6c58ae6666

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Comment on lines 349 to 361
metrics.trackEvent(
metrics
.createEventBuilder(MetaMetricsEvents.ANALYTICS_PREFERENCE_SELECTED)
.addProperties({
...dataCollectionForMarketingTraits,
is_metrics_opted_in: true,
location: 'onboarding_metametrics',
updated_after_onboarding: false,
})
.build(),
);

// trait indicating if user opts in for data collection for marketing
let dataCollectionForMarketingTraits;
if (this.props.isDataCollectionForMarketingEnabled) {
dataCollectionForMarketingTraits = { has_marketing_consent: true };
}
await metrics.enable();
Copy link
Contributor

Choose a reason for hiding this comment

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

this can not work if you track the event before await metrics.enable();.
The tracking will be skipped.

@jonybur jonybur added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 82199aa
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/3d9b1e0d-eb2a-4f14-93f1-35f8647be175

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@jonybur jonybur marked this pull request as ready for review January 10, 2025 16:05
@jonybur jonybur requested a review from a team as a code owner January 10, 2025 16:05
@jonybur jonybur added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 10, 2025
Copy link
Contributor

https://bitrise.io/ Bitrise

🔄🔄🔄 pr_smoke_e2e_pipeline started on Bitrise...🔄🔄🔄

Commit hash: 38f1ecc
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/ffc8ed1e-d90c-4005-8ef6-406fc7cfa2c2

Note

  • This comment will auto-update when build completes
  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@jonybur jonybur added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 10, 2025
Copy link
Contributor

github-actions bot commented Jan 10, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 6954b0c
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/abc612f1-eb2e-4799-bf04-bcf2a22ec513

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants