diff --git a/app/components/UI/Navbar/index.js b/app/components/UI/Navbar/index.js index 24f5c804c82..68dab60cb2d 100644 --- a/app/components/UI/Navbar/index.js +++ b/app/components/UI/Navbar/index.js @@ -171,6 +171,7 @@ export function getNavigationOptionsTitle( navigation, isFullScreenModal, themeColors, + navigationPopEvent, ) { const innerStyles = StyleSheet.create({ headerTitleStyle: { @@ -188,6 +189,7 @@ export function getNavigationOptionsTitle( }, }); function navigationPop() { + if (navigationPopEvent) trackEvent(navigationPopEvent); navigation.pop(); } return { diff --git a/app/components/Views/RevealPrivateCredential/index.js b/app/components/Views/RevealPrivateCredential/index.js index cf22ff738b8..da293d1c85a 100644 --- a/app/components/Views/RevealPrivateCredential/index.js +++ b/app/components/Views/RevealPrivateCredential/index.js @@ -238,12 +238,17 @@ class RevealPrivateCredential extends PureComponent { navigation, false, colors, + AnalyticsV2.ANALYTICS_EVENTS.GO_BACK_SRP_SCREEN, ), ); }; async componentDidMount() { this.updateNavBar(); + // Track SRP Reveal screen rendered + if (!this.isPrivateKey()) { + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.REVEAL_SRP_SCREEN); + } // Try to use biometrics to unloc // (if available) const biometryType = await SecureKeychain.getSupportedBiometryType(); @@ -289,6 +294,10 @@ class RevealPrivateCredential extends PureComponent { { view: 'Enter password' }, ); + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent( + AnalyticsV2.ANALYTICS_EVENTS.CANCEL_REVEAL_SRP_CTA, + ); if (this.props.cancel) return this.props.cancel(); this.navigateBack(); }; @@ -298,6 +307,12 @@ class RevealPrivateCredential extends PureComponent { navigation.pop(); }; + done = () => { + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.SRP_DONE_CTA); + this.navigateBack(); + }; + async tryUnlockWithPassword(password, privateCredentialName) { const { KeyringController } = Engine.context; const { selectedAddress } = this.props; @@ -345,6 +360,8 @@ class RevealPrivateCredential extends PureComponent { } tryUnlock = () => { + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.NEXT_REVEAL_SRP_CTA); this.setState({ isModalVisible: true }); }; @@ -360,6 +377,9 @@ class RevealPrivateCredential extends PureComponent { { action: 'copied to clipboard' }, ); + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.COPY_SRP); + const { clipboardPrivateCredential } = this.state; await ClipboardManager.setStringExpire(clipboardPrivateCredential); @@ -423,6 +443,9 @@ class RevealPrivateCredential extends PureComponent { : AnalyticsV2.ANALYTICS_EVENTS.REVEAL_SRP_COMPLETED, { action: 'viewed SRP' }, ); + + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.VIEW_SRP); } else if (event.i === 1) { AnalyticsV2.trackEvent( this.isPrivateKey() @@ -430,6 +453,9 @@ class RevealPrivateCredential extends PureComponent { : AnalyticsV2.ANALYTICS_EVENTS.REVEAL_SRP_COMPLETED, { action: 'viewed QR code' }, ); + + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.VIEW_SRP_QR); } }; @@ -535,6 +561,11 @@ class RevealPrivateCredential extends PureComponent { { view: 'Hold to reveal' }, ); + if (!this.isPrivateKey()) + AnalyticsV2.trackEvent( + AnalyticsV2.ANALYTICS_EVENTS.SRP_DISMISS_HOLD_TO_REVEAL_DIALOG, + ); + this.setState({ isModalVisible: false, }); @@ -669,7 +700,7 @@ class RevealPrivateCredential extends PureComponent { : strings('reveal_credential.cancel') } confirmText={strings('reveal_credential.confirm')} - onCancelPress={unlocked ? this.navigateBack : this.cancel} + onCancelPress={unlocked ? this.done : this.cancel} testID={`next-button`} onConfirmPress={() => this.tryUnlock()} showConfirmButton={!unlocked} diff --git a/app/components/Views/Settings/SecuritySettings/index.js b/app/components/Views/Settings/SecuritySettings/index.js index 2b0f34db343..adf6dc48626 100644 --- a/app/components/Views/Settings/SecuritySettings/index.js +++ b/app/components/Views/Settings/SecuritySettings/index.js @@ -371,6 +371,7 @@ class Settings extends PureComponent { componentDidMount = async () => { this.updateNavBar(); + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.VIEW_SECURITY_SETTINGS); const biometryType = await SecureKeychain.getSupportedBiometryType(); const analyticsEnabled = Analytics.checkEnabled(); const currentSeedphraseHints = await AsyncStorage.getItem( @@ -590,6 +591,7 @@ class Settings extends PureComponent { goToRevealPrivateCredential = () => { AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.REVEAL_SRP_INITIATED); + AnalyticsV2.trackEvent(AnalyticsV2.ANALYTICS_EVENTS.REVEAL_SRP_CTA); this.props.navigation.navigate('RevealPrivateCredentialView', { privateCredentialName: 'seed_phrase', }); diff --git a/app/util/analyticsV2.js b/app/util/analyticsV2.js index 4eb9950feac..c1f4887ddcc 100644 --- a/app/util/analyticsV2.js +++ b/app/util/analyticsV2.js @@ -110,11 +110,27 @@ export const ANALYTICS_EVENTS_V2 = { BROWSER_SHARE_SITE: generateOpt('Shared A Site'), BROWSER_RELOAD: generateOpt('Reload Browser'), BROWSER_ADD_FAVORITES: generateOpt('Added Site To Favorites'), - // Settings - // Reveal Credentials + // Security & Privacy Settings + VIEW_SECURITY_SETTINGS: generateOpt('Views Security & Privacy'), + // Reveal SRP + REVEAL_SRP_CTA: generateOpt('Clicks Reveal Secret Recovery Phrase'), + REVEAL_SRP_SCREEN: generateOpt('Views Reveal Secret Recovery Phrase'), + GO_BACK_SRP_SCREEN: generateOpt('Clicked Back on Reveal SRP Password Page'), + CANCEL_REVEAL_SRP_CTA: generateOpt( + 'Clicks Cancel on Reveal Secret Recovery Phrase Page', + ), + NEXT_REVEAL_SRP_CTA: generateOpt( + 'Clicks Next on Reveal Secret Recovery Phrase', + ), + VIEW_SRP: generateOpt('Views SRP'), + SRP_DISMISS_HOLD_TO_REVEAL_DIALOG: generateOpt('Closes Hold To Reveal SRP'), + VIEW_SRP_QR: generateOpt('Views SRP QR code'), + COPY_SRP: generateOpt('Copies SRP to clipboard'), + SRP_DONE_CTA: generateOpt('Clicks Done with SRP'), REVEAL_SRP_INITIATED: generateOpt('Reveal SRP Initiated'), REVEAL_SRP_CANCELLED: generateOpt('Reveal SRP Cancelled'), REVEAL_SRP_COMPLETED: generateOpt('Reveal SRP Completed'), + // Reveal Private Key REVEAL_PRIVATE_KEY_INITIATED: generateOpt('Reveal Private Key Initiated'), REVEAL_PRIVATE_KEY_CANCELLED: generateOpt('Reveal Private Key Cancelled'), REVEAL_PRIVATE_KEY_COMPLETED: generateOpt('Reveal Private Key Completed'),