Last active
July 24, 2019 22:29
-
-
Save ronal2do/e947c44201292e6c4c4b436fd71f83e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Identify | |
const trackingOpts = { id, usernameOrEmail: email }; | |
Analytics.identify(id, TrackingOpts); | |
// Simple event | |
Analytics.track(Analytics.events.BOOTSTRAP); | |
// Event with paramenters | |
Analytics.track(Analytics.events.USER_CREATED_ACCOUNT, trackingOpts); | |
// Errors handling | |
try { | |
// do something | |
} catch(error) { | |
Analytics.track(Analytics.events.ERROR, { error }); | |
... | |
} | |
// PageView with react-navigation | |
<AppNavigator | |
uriPrefix={...} | |
onNavigationStateChange={(prevState, currentState, action) => { | |
const currentScreen = getActiveRouteName(currentState); | |
const prevScreen = getActiveRouteName(prevState); | |
if (prevScreen !== currentScreen) { | |
Analytics.track(Analytics.events.USER_PAGE_VIEW, { view: currentScreen }); | |
} | |
}} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment