1.0.0 • Published 6 years ago
react-native-react-native-chartbeat v1.0.0
react-native-react-native-chartbeat
NOT FOR PRODUCTION USE.
Currently developing for iOS only (WIP).
Getting started
$ npm install react-native-chartbeat --save || yarn add react-native-chartbeat
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-react-native-chartbeat
and addRNReactNativeChartbeat.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNReactNativeChartbeat.a
to your project'sBuild Phases
➜Link Binary With Libraries
- In XCode, in the project navigator, select your project. Look for
Framework Search Paths
inBuild Settings
, then add($PROJECT_DIR)
and$(inherited)
. - Drag
Chartbeat.framework
fromnode_modules/react-native-chartbeat/ios/Frameworks
to yourFrameworks
folder in XCode. - Add the following code to
AppDelegate.m
:
#import <Chartbeat/CBTracker.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[CBTracker sharedTracker] setDebugMode:true]; // For debugging purposes
[[CBTracker sharedTracker] setLogLevel:CBTrackerLogLevelVerbose]; // For debugging purposes
[[CBTracker sharedTracker] setupTrackerWithAccountId:1111 domain:@"domain.com" ]; // Required
...
}
- Run your project (
Cmd+R
)<
Usage
import Chartbeat from 'react-native-react-native-chartbeat';
Chartbeat.trackView('testViewId', 'testTitle');