SDKs
React Native SDK
Add Tracklyne to a React Native or Expo app: events, screens, an offline queue, consent and uncaught errors.
Install
npm install @tracklyne/react-native @react-native-async-storage/async-storageimport AsyncStorage from "@react-native-async-storage/async-storage";
import tracklyne, { TracklyneProvider, useScreenTracking } from "@tracklyne/react-native";
tracklyne.init({ token: "tl_your_project_token", storage: AsyncStorage, appVersion: "1.0.0" });
tracklyne.capture("session joined", { entry: "app" });
useScreenTracking(usePathname()); // Expo Router, inside <TracklyneProvider client={tracklyne}>Offline, consent and errors
Events wait in a queue kept in storage. They go out when the network is back, even after a restart. Without storage, the queue lives in memory only.
tracklyne.init({ token: "tl_your_project_token", storage: AsyncStorage, defaultConsent: false });
tracklyne.optIn(); // after the user accepts
tracklyne.optOut(); // drops the queueApp opens and backgrounding are sent automatically. Uncaught errors arrive in error tracking. Turn them off with captureLifecycle: false and captureErrors: false.