Documentation
React Native
Use the @tacko/telemetry-react-native package for React Native apps. It starts a session on init, registers a global error handler with ErrorUtils, and re-exports trackEvent, trackError, screen, and identify. Sessions and events include anonymous id and SDK version (from core).
Install
pnpm add @tacko/telemetry-react-native
# or
npm install @tacko/telemetry-react-nativeSetup
Call init() once at app startup (e.g. in your root component or entry file), on both iOS and Android. The core SDK only installs browser error handlers in a real browser, so init() is safe on native and enables screen(), endSession(), and all other APIs—you do not need to guard it for web only.
import { init } from "@tacko/telemetry-react-native";
init({
ingestUrl: "https://your-api.example.com",
app: "my-rn-app",
platform: "react-native",
});Session tracking
The package automatically creates a session when you call init() and sends it to POST /ingest/session. You can call endSession() when the app goes to background if you want to close the session (e.g. in an app state listener).
Screen tracking
Call screen(screenName) when the user navigates to a screen (e.g. in your navigator’s screen listener or in a useFocusEffect).
import { screen } from "@tacko/telemetry-react-native";
screen("Home");
screen("Profile");Events and errors
import { trackEvent, trackError, identify } from "@tacko/telemetry-react-native";
trackEvent("button_press", { screen: "Home", id: "submit" });
trackError(new Error("Something broke"), { screen: "Checkout" });
identify(user.id);Global error handler
After init(), the package sets ErrorUtils.setGlobalHandler so unhandled JavaScript errors are sent to the ingest API. The previous handler is not re-invoked (to avoid duplicate reports).