Written by Tal Kain tal@kain.net, Tony Xiao tonyx.ca@gmail.com and other contributors.
Based on Segment (https://segment.com) Analytics project. See iOS SDK and Android SDK.
npm install --save react-native-analytics
pod "Analytics"
to your project..xcworkspace
file), go to the project navigator and right click Libraries
-> Add Files to [your project's name]
.node_modules/react-native-analytics/ios
-> and choose the RNAnalytics
folder.npm install --save react-native-analytics
rnpm link
. Otherwise add to android/app/src/main/java/com/your-app-name/MainActivity.java
:import com.facebook.react.ReactPackage;
import com.smore.RNSegmentIOAnalytics.RNSegmentIOAnalyticsPackage; // <-- add this
...
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSegmentIOAnalyticsPackage(), // <-- add this
...
);
import Analytics from 'react-native-analytics'
const segmentIOWriteKey = "SEGMENT_IO_WRITE_KEY"
const flushEverySecondsCount = 1
Analytics.setup(segmentIOWriteKey, flushEverySecondsCount)
Analytics.identify("testing", {"name":"test name"})
Analytics.track("test track", {"name":"test track with name"})
Analytics.screen("test screen", {"screenType":"SCREEN NAME"})
Analytics.flush()
Analytics.reset()
https://segment.com/docs/libraries/ios/#getting-started https://segment.com/docs/libraries/android/#getting-started
ld: '......./Pods/GoogleIDFASupport/Libraries/libAdIdAccessLibrary.a(TAGActualAdIdAccess.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
There are instructions for fixing it here: https://stackoverflow.com/questions/31395260/google-analytics-libadidaccess-a-does-not-contain-bitcode
This project is released under the MIT License.