How to use the @segment/analytics-react-native.setup function in @segment/analytics-react-native

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 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 LedgerHQ / ledger-live-mobile / src / analytics / segment.js View on Github external
export const start = async (store: *) => {
  if (token) {
    await analytics.setup(token, {
      android: {
        collectDeviceId: false,
      },
      ios: {
        trackAdvertising: false,
        trackDeepLinks: false,
      },
    });
  }

  const { user, created } = await getOrCreateUser();
  storeInstance = store;
  if (created) {
    if (ANALYTICS_LOGS) console.log("analytics:identify", user.id);
    if (token) {
      await analytics.reset();
github celo-org / celo-monorepo / packages / react-components / analytics / CeloAnalytics.tsx View on Github external
Logger: ReactNativeLogger,
    apiKey?: string,
    defaultTestnet?: string
  ) {
    this.appName = appName
    this.Logger = Logger
    this.propertyPathWhiteList = propertyPathWhiteList
    this.apiKey = apiKey
    this.defaultTestnet = defaultTestnet

    if (!apiKey) {
      Logger.debug(TAG, 'Segment API Key not present, likely due to environment. Skipping enabling')
      return
    }

    Analytics.setup(apiKey, SEGMENT_OPTIONS).catch(() => _)
    Logger.debug(TAG, 'Segment Analytics Integration initialized!')

    getDeviceInfo()
      .then((res) => (this.deviceInfo = res))
      .catch((err) => Logger.error(TAG, 'getDeviceInfo error', err))
  }
github rainbow-me / rainbow / src / App.js View on Github external
handleInitializeAnalytics = async () => {
    const storedIdentifier = await keychain.loadString('analyticsUserIdentifier');

    if (!storedIdentifier) {
      const identifier = await RNIOS11DeviceCheck.getToken()
        .then((deviceId) => deviceId)
        .catch(() => nanoid());
      await keychain.saveString('analyticsUserIdentifier', identifier);
      analytics.identify(identifier);
    }

    await analytics.setup(REACT_APP_SEGMENT_API_WRITE_KEY, {
      ios: {
        trackDeepLinks: true,
      },
      trackAppLifecycleEvents: true,
      trackAttributionData: true,
    });
  }