uptimemesh-rn
v1.2.2
Published
UptimeMesh React Native SDK — crash, performance and network monitoring
Maintainers
Readme
uptimemesh-rn
React Native SDK for UptimeMesh — automatic crash reporting, network request monitoring, screen tracking and session analytics.
Features
- Automatic crash reporting — unhandled JS errors and fatal exceptions
- Network monitoring — all
fetchrequests tracked automatically - Session tracking — device info, OS version, app version, network type
- User identification — associate sessions with your users via
identify() - Screen tracking — manual or via React Navigation
- Custom events — track any user action with properties
- Offline buffer — events saved locally when offline, sent when connection returns
- Batch sending — efficient batching, no per-event requests
- TypeScript — full type definitions included
Installation
npm install uptimemesh-rn
# or
yarn add uptimemesh-rnOptional: Offline buffer support
Install AsyncStorage to persist events when the app is offline:
npm install @react-native-async-storage/async-storage
npx pod-install # iOS onlyIf not installed, events are kept in memory only (lost on app kill while offline).
Quick Start
// App.js or App.tsx
import UptimeMesh from 'uptimemesh-rn';
UptimeMesh.init('YOUR_API_KEY');Get your API key from the UptimeMesh dashboard → Mobil Uygulamalar → [App] → Entegrasyon.
API Reference
UptimeMesh.init(apiKey, options?)
Initialize the SDK. Call this once, as early as possible in your app entry point.
UptimeMesh.init('YOUR_API_KEY', {
debug: true, // print SDK logs to console
flushInterval: 30000, // send events every 30 seconds (ms)
maxQueueSize: 50, // auto-flush when 50 events are queued
// AdBlocker bypass: kendi proxy'nizi kullanmak için:
// ingestUrl: 'https://yourdomain.com/um-proxy',
});| Option | Type | Default | Description |
|--------|------|---------|-------------|
| ingestUrl | string | https://ingest.uptimemesh.com | Ingest endpoint (AdBlocker bypass için override) |
| flushInterval | number | 30000 | Interval in ms between automatic flushes |
| maxQueueSize | number | 50 | Queue size that triggers an immediate flush |
| debug | boolean | false | Log SDK activity to console |
| apiUrl | string | — | Deprecated — ingestUrl kullanın |
UptimeMesh.identify(userId)
Associate the current session (and all future sessions) with a user.
Call this after login and pass null after logout.
// After successful login
const user = await authService.login(email, password);
UptimeMesh.identify(user.id); // or user.email, username, etc.
// After logout
await authService.logout();
UptimeMesh.identify(null);Once set, the user ID appears in the UptimeMesh dashboard → Mobil Uygulamalar → [App] → Oturumlar table under the Kullanıcı column.
Note: Sessions recorded before
identify()is called will show—in the dashboard. The user ID is attached to the session from the momentidentify()is called.
UptimeMesh.trackScreen(name)
Track a screen view.
UptimeMesh.trackScreen('HomeScreen');
UptimeMesh.trackScreen('ProductDetail');With React Navigation — add a listener to NavigationContainer:
import { useNavigationContainerRef } from '@react-navigation/native';
const navigationRef = useNavigationContainerRef();
<NavigationContainer
ref={navigationRef}
onStateChange={() => {
const route = navigationRef.getCurrentRoute();
if (route) UptimeMesh.trackScreen(route.name);
}}
>
{/* ... */}
</NavigationContainer>UptimeMesh.trackClick(elementName, screen?)
Buton veya element tıklamalarını loglar. trackEvent('click', ...) için kısayol.
UptimeMesh.trackClick('checkout_button', 'CartScreen');
UptimeMesh.trackClick('menu_item_profile');Dashboard'da Events → click event'i olarak görünür. element ve screen alanları filtrelenebilir.
UptimeMesh.trackEvent(name, properties?)
Track a custom event with optional metadata.
UptimeMesh.trackEvent('purchase_completed', { amount: 99.90, currency: 'TRY' });
UptimeMesh.trackEvent('video_played', { videoId: 'abc123', duration: 120 });İpucu: Dashboard'daki Events → Arama panelinden
event_name=purchase_completed,amount__gt:50gibi filtreler uygulayabilirsiniz.
UptimeMesh.captureError(error)
Manually report a caught error.
try {
await loadUserData();
} catch (error) {
UptimeMesh.captureError(error);
}UptimeMesh.flush()
Immediately send all queued events. Useful before app close or logout.
await UptimeMesh.flush();UptimeMesh.shutdown()
Stop the SDK, flush remaining events, and remove all interceptors.
UptimeMesh.shutdown();What's Collected Automatically
| Data | Source | Can Disable |
|------|--------|-------------|
| Unhandled JS crashes | ErrorUtils.setGlobalHandler | No (core feature) |
| Network requests (URL, method, status, duration) | global.fetch intercept | — |
| Session start/end | AppState listener | — |
| Device model | Platform.constants | — |
| OS name & version | Platform.OS, Platform.Version | — |
| App version | Passed via deviceInfo | — |
Privacy: Query strings are stripped from all URLs before sending.
Example:https://api.example.com/users?token=abc→https://api.example.com/users
Event Types
| Type | Description | Triggered By |
|------|-------------|--------------|
| crash | Unhandled fatal error | ErrorUtils |
| error | Caught / non-fatal error | captureError() |
| screen | Screen view | trackScreen() |
| event | Custom user action | trackEvent() |
| network | HTTP request | fetch interceptor |
Offline Mode
When the device has no internet connection:
- Events are saved to
AsyncStorage(if installed) - On next app launch or reconnect, saved events are sent automatically
- Without AsyncStorage: events stay in memory until the app is killed
TypeScript Usage
import UptimeMesh, { UptimeMeshOptions } from 'uptimemesh-rn';
const options: UptimeMeshOptions = {
debug: __DEV__,
flushInterval: 15_000,
};
UptimeMesh.init('YOUR_API_KEY', options);Expo Support
Works with both Expo managed and bare workflow.
For Expo managed, AsyncStorage requires a custom dev client or bare workflow:
npx expo install @react-native-async-storage/async-storageTroubleshooting
Events not appearing in the dashboard?
- Enable
debug: trueand check console for[UptimeMesh]logs - Verify your API key in UptimeMesh dashboard → Entegrasyon
- Call
await UptimeMesh.flush()and check for network errors
Crash handler not working in production?
- Make sure
init()is called before any other code inApp.js - In Expo:
init()insideregisterRootComponentcallback
Network requests not tracked?
- The SDK intercepts
global.fetch. If you useaxios, it uses fetch internally and will be tracked automatically. XMLHttpRequestis not intercepted (fetch-only)
Changelog
1.2.2
- README güncellendi:
trackClick,ingestUrl, AdBlocker bypass dokümantasyonu eklendi
1.2.1
UptimeMesh.trackClick(elementName, screen?)— click event kısayoluUptimeMeshOptions.ingestUrl— AdBlocker bypass için özel endpoint- Varsayılan endpoint
ingest.uptimemesh.comolarak değiştirildi apiUrldeprecated edildi
1.2.0
identify(userId)— associate a user with the current and future sessionsuser_idfield added toSessionData
1.1.0
localeandtimezonefields in session datatrackScreen(name, durationMs?)— optional transition time
1.0.0
- Initial release
- Crash reporting, network monitoring, session tracking
- React Navigation integration
- Offline buffer via AsyncStorage
- TypeScript support
License
MIT © UptimeMesh
