Nucleus를 시작하려면 Nucleus에서 계정을 만들고 앱 ID를 잡은 다음 SDK를 사용하여 이벤트 추적 이벤트를 시작하십시오.
이 패키지에는 @react-native-async-storage/async-storage 및 @react-native-community/netinfo 피어 종속성으로 있습니다. 당신이 가지고 있지 않은 경우 먼저 설치하십시오
yarn add @react-native-async-storage/async-storage @react-native-community/netinfo 그런 다음 nucleus-rn NPM 패키지로 설치하십시오 (권장)
# with yarn
yarn add nucleus-rn import Nucleus from 'nucleus-rn' ;
Nucleus . init ( 'YOUR_APP_ID' ) ; 'YOUR_APP_ID' 앱의 고유 한 ID로 바꾸십시오. 여기서 얻을 수 있습니다.
여기에서 다른 프레임 워크가있는 예제를 확인할 수 있습니다.
Nucleus는 다음 옵션을 Nucleus.init() 메소드에 대한 두 번째 인수로 전달하는 것을 지원합니다.
Nucleus . init ( 'APP_ID' , {
appVersion : '0.0.0' , // the version of your application
endpoint : 'wss://app.nucleus.sh' , // only option, we don't allow self hosting yet :(
disableInDev : true , // disable in development mode. We recommend not to call
// `init` method, as that will be more reliable.
debug : false , // if set to `true`, will log a bunch of things.
disableTracking : false , // will not track anything. You can also use `Nucleus.disableTracking()`.
// note that some events will still be added to the queue, so if you call
// Nucleus.enableTracking() again, they will be sent to the server.
reportInterval : 2 * 1000 , // at which interval the events are sent to the server.
sessionTimeout : 60 * 30 * 1000 , // time after which the session is ended
cutoff : 60 * 60 * 48 * 1000 , // time after which event that were not sent yet are deleted
disableErrorReports : false , // wether to disable error tracking
} )선택적 사용자 정의 데이터로 이벤트를 추적합니다
Nucleus . track ( "click" , { foo : 'bar' } ) ;이름과 오류 객체로 오류를 추적합니다.
Nucleus . trackError ( name , error ) ; 기본적으로 Nucleus는 API에 'GlobalError' 오류를 보내는 ErrorUtils.setGlobalHandler 의 핸들러를 등록합니다. 이 동작을 비활성화하려면 disableErrorReports true 로 설정할 수 있습니다.
Nucleus . init ( 'APP_ID' , { disableErrorReports : true } ) Nucleus.trackError('an error', errObject) 사용하여 수동으로 오류를 잡습니다.
고유 한 ID로 사용자를 식별하고 선택적으로 사용자 정의 속성을 설정하십시오.
Nucleus . identify ( '04f8846d-ecca-4a81-8740-f6428ceb7f7b' , { firstName : 'Jordan' , lastName : 'Walke' } ) ;화면 이름과 선택적 매개 변수로 화면보기를 추적합니다.
Nucleus . page ( '/about' , { foo : 'baz' } ) ;추적을 비활성화합니다
Nucleus . disableTracking ( ) ;추적을 활성화합니다
Nucleus . enableTracking ( ) ; 우리는 항상 지역 사회의 기여를 찾고 있습니다. 도움을 줄 수있는 방법은 다음과 같습니다.