How to use @segment/analytics-react-native - 10 common examples

To help you get started, we’ve selected a few @segment/analytics-react-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rainbow-me / rainbow / src / screens / Routes.js View on Github external
//   })
          // );
        }

        if (routeName === 'ExpandedAssetScreen') {
          const { asset, type } = params;
          paramsToTrack = {
            assetContractAddress:
              asset.address || get(asset, 'asset_contract.address'),
            assetName: asset.name,
            assetSymbol: asset.symbol || get(asset, 'asset_contract.symbol'),
            assetType: type,
          };
        }

        return analytics.screen(routeName, paramsToTrack);
      }
    }}
    ref={ref}
github rainbow-me / rainbow / src / screens / Routes.js View on Github external
onNavigationStateChange={(prevState, currentState) => {
      const { params, routeName } = Navigation.getActiveRoute(currentState);
      const prevRouteName = Navigation.getActiveRouteName(prevState);
      // native stack rn does not support onTransitionEnd and onTransitionStart
      if (
        prevRouteName === 'ImportSeedPhraseSheet' &&
        (routeName === 'ProfileScreen' || routeName === 'WalletScreen')
      ) {
        StatusBar.setBarStyle('dark-content');
      }

      if (routeName === 'SettingsModal') {
        let subRoute = get(params, 'section.title');
        if (subRoute === 'Settings') subRoute = null;
        return analytics.screen(
          `${routeName}${subRoute ? `>${subRoute}` : ''}`
        );
      }

      if (routeName !== prevRouteName) {
        let paramsToTrack = null;

        if (
          prevRouteName === 'MainExchangeScreen' &&
          routeName === 'WalletScreen'
        ) {
          // store.dispatch(updateTransitionProps({ blurColor: null }));
        } else if (
          prevRouteName === 'WalletScreen' &&
          routeName === 'MainExchangeScreen'
        ) {
github segmentio / analytics-react-native / packages / test-app / seed / App.tsx View on Github external
margin: 20
  },
  text: {
    color: '#FBFAF9'
  },
  container: {
    flex: 1,
    justifyContent: 'flex-start',
    alignItems: 'center',
    backgroundColor: '#32A75D'
  }
})

import integrations from './integrations.gen'

analytics
    .setup('SEGMENT_WRITE_TOKEN', {
      debug: true,
      using: integrations
    })
    .then(() => console.log('Analytics ready'))
    .catch(err => console.error(err))
github segmentio / analytics-react-native / packages / test-app / seed / App.tsx View on Github external
const logAnonymousId = async () => {
  console.log('anonymousId: %s', await analytics.getAnonymousId())
}
github segmentio / analytics-react-native / packages / test-app / seed / App.tsx View on Github external
const trackOrder = () => {
  analytics.track('Order Completed')
  analytics.track('Order Cancelled', {
    order_id: 323
  })
  analytics.identify('userIdOnly')
  analytics.identify('userId', {
    age: 32
  })
  analytics.alias('newlyAliasedId')
  analytics.screen('User Login Screen', {
    method: 'google'
  })
}
github segmentio / analytics-react-native / packages / test-app / App.js View on Github external
const trackOrder = () => {
	analytics.track('Order Completed')
	analytics.track('Order Cancelled', {
		order_id: 323
	})
	analytics.identify('userIdOnly')
	analytics.identify('userId', {
		age: 32
	})
	analytics.alias('newlyAliasedId')
	analytics.screen('User Login Screen', {
		method: 'google'
	})
}
github segmentio / analytics-react-native / packages / test-app / seed / App.tsx View on Github external
const trackOrder = () => {
  analytics.track('Order Completed')
  analytics.track('Order Cancelled', {
    order_id: 323
  })
  analytics.identify('userIdOnly')
  analytics.identify('userId', {
    age: 32
  })
  analytics.alias('newlyAliasedId')
  analytics.screen('User Login Screen', {
    method: 'google'
  })
}
github segmentio / analytics-react-native / packages / test-app / seed / App.tsx View on Github external
const trackOrder = () => {
  analytics.track('Order Completed')
  analytics.track('Order Cancelled', {
    order_id: 323
  })
  analytics.identify('userIdOnly')
  analytics.identify('userId', {
    age: 32
  })
  analytics.alias('newlyAliasedId')
  analytics.screen('User Login Screen', {
    method: 'google'
  })
}