Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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))
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();
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))
}
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,
});
}