@justanalyticsapp/react-native
v0.1.0
Published
JustAnalytics React Native SDK for crash reporting, network tracking, and mobile observability
Downloads
37
Maintainers
Readme
@justanalyticsapp/react-native
React Native SDK for JustAnalytics -- crash reporting, network tracking, navigation analytics, and performance monitoring.
Installation
npm install @justanalyticsapp/react-nativeQuick Start
import JustAnalytics from '@justanalyticsapp/react-native';
JustAnalytics.init({
siteId: 'your-site-id',
apiKey: 'ja_sk_your_api_key',
environment: 'production',
release: '1.0.0',
});Features
- Crash Reporting -- Global error handler + React ErrorBoundary
- Network Tracking -- Automatic fetch/XHR interception with distributed tracing
- Navigation -- React Navigation and Expo Router screen view tracking
- Performance -- App start time and screen render measurement
- Offline Support -- AsyncStorage-backed queue with retry
API
Core
JustAnalytics.init(options)-- Initialize the SDKJustAnalytics.captureException(error, options?)-- Report an errorJustAnalytics.captureMessage(message, level?, options?)-- Report a messageJustAnalytics.trackEvent(name, properties?)-- Track a custom eventJustAnalytics.setUser({ id, email, username })-- Set user contextJustAnalytics.setTag(key, value)-- Set a global tagJustAnalytics.flush()-- Flush pending dataJustAnalytics.close()-- Shut down the SDK
Crash Reporting
import { ErrorBoundary } from '@justanalyticsapp/react-native';
<ErrorBoundary fallback={<Text>Error occurred</Text>}>
<App />
</ErrorBoundary>Navigation
// React Navigation
const ref = createNavigationContainerRef();
<NavigationContainer
ref={ref}
onReady={() => JustAnalytics.recordInitialRoute(ref)}
onStateChange={JustAnalytics.createNavigationListener(ref)}
/>
// Expo Router
JustAnalytics.trackExpoRouterNavigation(pathname);Performance
JustAnalytics.markAppReady(); // After first render
const id = JustAnalytics.startScreenRender('HomeScreen');
// ... render completes ...
JustAnalytics.endScreenRender(id);License
MIT
