additional events to track first run flow

This commit is contained in:
Akinwale Ariwodola 2019-06-21 08:21:14 +01:00
parent 9d6cf369d6
commit ea60df592f
3 changed files with 28 additions and 6 deletions

View file

@ -43,7 +43,7 @@ class EmailCollectPage extends React.PureComponent {
const { onEmailViewLayout } = this.props; const { onEmailViewLayout } = this.props;
const content = ( const content = (
<View onLayout={onEmailViewLayout}> <View onLayout={() => onEmailViewLayout('collect')}>
<Text style={firstRunStyle.title}>Setup account</Text> <Text style={firstRunStyle.title}>Setup account</Text>
<TextInput <TextInput
style={firstRunStyle.emailInput} style={firstRunStyle.emailInput}

View file

@ -20,7 +20,7 @@ class EmailVerifyPage extends React.PureComponent {
const { onEmailViewLayout, email } = this.props; const { onEmailViewLayout, email } = this.props;
const content = ( const content = (
<View onLayout={onEmailViewLayout}> <View onLayout={() => onEmailViewLayout('verify')}>
<Text style={firstRunStyle.title}>Verify Email</Text> <Text style={firstRunStyle.title}>Verify Email</Text>
<Text style={firstRunStyle.paragraph}> <Text style={firstRunStyle.paragraph}>
An email has been sent to{' '} An email has been sent to{' '}

View file

@ -24,7 +24,9 @@ class FirstRunScreen extends React.PureComponent {
state = { state = {
currentPage: null, currentPage: null,
email: null, email: null,
emailCollectTracked: false,
emailSubmitted: false, emailSubmitted: false,
enterPasswordTracked: false,
isFirstRun: false, isFirstRun: false,
launchUrl: null, launchUrl: null,
showSkip: false, showSkip: false,
@ -32,7 +34,7 @@ class FirstRunScreen extends React.PureComponent {
skipAccountConfirmed: false, skipAccountConfirmed: false,
showBottomContainer: false, showBottomContainer: false,
walletPassword: null, walletPassword: null,
syncApplyStarted: false, syncApplyStarted: false
}; };
componentDidMount() { componentDidMount() {
@ -44,7 +46,10 @@ class FirstRunScreen extends React.PureComponent {
if (NativeModules.FirstRun) { if (NativeModules.FirstRun) {
NativeModules.FirstRun.isFirstRun().then(firstRun => { NativeModules.FirstRun.isFirstRun().then(firstRun => {
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
this.setState({ isFirstRun: firstRun }); this.setState({ isFirstRun: firstRun });
if (firstRun) { if (firstRun) {
this.setState({ currentPage: FirstRunScreen.pages[0] }); this.setState({ currentPage: FirstRunScreen.pages[0] });
} else { } else {
@ -118,6 +123,7 @@ class FirstRunScreen extends React.PureComponent {
handleLeftButtonPressed = () => { handleLeftButtonPressed = () => {
// Go to setup account page when "Setup account" is pressed // Go to setup account page when "Setup account" is pressed
if (Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage) { if (Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT === this.state.currentPage) {
this.setState({ emailCollectTracked: false }); // reset tracked flag
return this.showPage(Constants.FIRST_RUN_PAGE_EMAIL_COLLECT); return this.showPage(Constants.FIRST_RUN_PAGE_EMAIL_COLLECT);
} }
@ -128,6 +134,7 @@ class FirstRunScreen extends React.PureComponent {
// Go to email collection page if user cancels from email verification // Go to email collection page if user cancels from email verification
if (Constants.FIRST_RUN_PAGE_EMAIL_VERIFY === this.state.currentPage) { if (Constants.FIRST_RUN_PAGE_EMAIL_VERIFY === this.state.currentPage) {
this.setState({ emailCollectTracked: false }); // reset tracked flag
this.showPage(Constants.FIRST_RUN_PAGE_EMAIL_COLLECT); this.showPage(Constants.FIRST_RUN_PAGE_EMAIL_COLLECT);
} }
}; };
@ -228,10 +235,17 @@ class FirstRunScreen extends React.PureComponent {
} }
}; };
onEmailViewLayout = () => { onEmailViewLayout = (phase) => {
if ('collect' === phase) {
if (!this.state.emailCollectTracked) {
// we only want to track this once
this.setState({ emailCollectTracked: true }, () => NativeModules.Firebase.track('first_run_email_collect', null));
}
} else if ('verify' === phase) {
NativeModules.Firebase.track('first_run_email_verify', null);
}
this.setState({ showBottomContainer: true, showSkip: true }); this.setState({ showBottomContainer: true, showSkip: true });
AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL);
AsyncStorage.removeItem(Constants.KEY_EMAIL_VERIFY_PENDING);
}; };
onWalletPasswordChanged = password => { onWalletPasswordChanged = password => {
@ -239,6 +253,9 @@ class FirstRunScreen extends React.PureComponent {
}; };
onWalletViewLayout = () => { onWalletViewLayout = () => {
if (!this.state.enterPasswordTracked) {
this.setState({ enterPasswordTracked: true }, () => NativeModules.Firebase.track('first_run_enter_password', null));
}
this.setState({ showBottomContainer: true }); this.setState({ showBottomContainer: true });
}; };
@ -246,6 +263,11 @@ class FirstRunScreen extends React.PureComponent {
this.setState({ showBottomContainer: true }); this.setState({ showBottomContainer: true });
}; };
onSkipAccountViewLayout = () => {
NativeModules.Firebase.track('first_run_skip_account', null);
this.setState({ showBottomContainer: true });
};
onSkipSwitchChanged = checked => { onSkipSwitchChanged = checked => {
this.setState({ skipAccountConfirmed: checked }); this.setState({ skipAccountConfirmed: checked });
}; };