Para comenzar con Nucleus, cree una cuenta en Nucleus y tome la ID de aplicación, luego use el SDK para comenzar a rastrear eventos.
Este paquete tiene @react-native-async-storage/async-storage y @react-native-community/netinfo como dependencias por pares. Instale primero si no los tiene
yarn add @react-native-async-storage/async-storage @react-native-community/netinfo Luego proceda a instalar nucleus-rn como paquete NPM (recomendado)
# with yarn
yarn add nucleus-rn import Nucleus from 'nucleus-rn' ;
Nucleus . init ( 'YOUR_APP_ID' ) ; Reemplace 'YOUR_APP_ID' con la ID única de su aplicación. Puedes conseguirlo aquí.
Puede consultar ejemplos con diferentes marcos aquí.
Nucleus admite pasar las siguientes opciones como segundo argumento al método 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
} )Rastrear eventos con datos personalizados opcionales
Nucleus . track ( "click" , { foo : 'bar' } ) ;Rastrear errores con un nombre y el objeto de error.
Nucleus . trackError ( name , error ) ; Por defecto 'GlobalError' Nucleus registra un controlador para ErrorUtils.setGlobalHandler . Si desea deshabilitar este comportamiento, puede establecer disableErrorReports en true :
Nucleus . init ( 'APP_ID' , { disableErrorReports : true } ) y capturar errores manualmente usando Nucleus.trackError('an error', errObject) .
Identifique a un usuario por una ID única y opcionalmente establece propiedades personalizadas.
Nucleus . identify ( '04f8846d-ecca-4a81-8740-f6428ceb7f7b' , { firstName : 'Jordan' , lastName : 'Walke' } ) ;Seguimiento de las vistas de la pantalla con el nombre de la pantalla y los parámetros opcionales.
Nucleus . page ( '/about' , { foo : 'baz' } ) ;Para deshabilitar el seguimiento
Nucleus . disableTracking ( ) ;Para habilitar el seguimiento
Nucleus . enableTracking ( ) ; Siempre estamos buscando contribuciones de la comunidad. Así es como puedes ayudar: