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

Bugfix: onboarding analytics #976

Merged
merged 10 commits into from
Aug 12, 2019
Merged

Conversation

estebanmino
Copy link
Contributor

Description

This PR adds the ability to save analytics events for first time onboarding flow. If the user wants to Start Exploring or Scan QR Code or Import Seedphrase, that event will be saved in state awaiting for the user to Optin or Optout in MetaMetrics. If the user Optin will send the event, if not, it will erase that information.

Related #930 (comment)

Checklist

  • There is a related GitHub issue
  • Tests are included if applicable
  • Any added code is fully documented

Issue

Resolves #???

@bdresser
Copy link
Contributor

bdresser commented Aug 2, 2019

fixes #978

this.continue();
};

/**
* Callback on press confirm
*/
onConfirm = async () => {
await AsyncStorage.setItem('@MetaMask:metricsOptIn', 'agreed');
// await AsyncStorage.setItem('@MetaMask:metricsOptIn', 'agreed');
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad, debug code don't modified good call

@@ -324,24 +353,17 @@ class ImportWallet extends PureComponent {
);
return false;
}

if (this.props.navigation.getParam('existingUser', false)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because we were doing the same thing here https://github.com/MetaMask/metamask-mobile/pull/976/files#diff-e78d44598405f73efa09c3b995881f68R340 before calling this onPressSync method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in fact this line is using a param that we don't provide when doing a navigation.push so this will always be false

};

/**
* Reducer to keep track of user oboarding actions to send it to analytics if thw user
Copy link
Contributor

Choose a reason for hiding this comment

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

typo "if THE user"

case 'SAVE_EVENT':
return {
...state,
event: action.event
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer if this was an array instead and you push events to the stack, so you can track the scenario of the user going to import wallet and then coming back to the first screen and then create a new wallet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

totally agree, added a comment on this on analytics sheet. As we didn't have this array analytics behavior there yet I chose to wait for MetaMask/Design#119

@brunobar79 brunobar79 added the needs-qa Any New Features that needs a full manual QA prior to being added to a release. label Aug 5, 2019
@@ -192,7 +214,11 @@ class OptinMetrics extends PureComponent {
onConfirm = async () => {
await AsyncStorage.setItem('@MetaMask:metricsOptIn', 'agreed');
Analytics.enable();
Analytics.trackEvent(ANALYTICS_EVENT_OPTS.ONBOARDING_METRICS_OPT_IN);
InteractionManager.runAfterInteractions(() => {
this.props.event && Analytics.trackEvent(this.props.event);
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming you have an array of events instead:

if(this.props.events && this.props.events.length){
    this.props.events.forEach(e => Analytics.trackEvent(e));
}

Copy link
Contributor

@brunobar79 brunobar79 left a comment

Choose a reason for hiding this comment

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

💯

@ibrahimtaveras00
Copy link
Contributor

ibrahimtaveras00 commented Aug 12, 2019

The events that are saved and triggered later are not being shown in mixpanel

As seen here (in this example I did import via seed phrase, but also happens with start exploring and sync)

image

This example is from an android device, but same thing happens on iOS as well

Example with iOS doing "start exploring"/create new wallet
image

@ibrahimtaveras00
Copy link
Contributor

Looks good 👍

@estebanmino estebanmino merged commit 46aae2b into develop Aug 12, 2019
@estebanmino estebanmino deleted the bugfix/onboarding-analytics branch August 20, 2019 18:04
rickycodes pushed a commit that referenced this pull request Jan 31, 2022
* handle state

* handle onboarding flow

* tests

* fix timing to save erase event

* dah

* typo

* events

* events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-qa Any New Features that needs a full manual QA prior to being added to a release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants