Agent setup: authorize Sight MCP and ask your agent to call get_tracking_setup. It configures this integration automatically.

React Native

Sight analytics for React Native. A standalone client (not a wrapper around @sightapp/analytics — RN has no window/document/history for that package to hook into), posting directly to the same /api/v1/track endpoint with the same wire shape.

Part of Sight — see sightapp/sight-backend SPEC.md and tasks/plan.md (Track B3).

Install

npm install @sightapp/react-native

Usage

import { init, track } from "@sightapp/react-native";
import AsyncStorage from "@react-native-async-storage/async-storage";

// Call once at app startup.
init("pk_...", {
  storage: AsyncStorage, // optional — persists the session id across restarts
});

// Anywhere:
track("signup");

storage isn't hard-wired to @react-native-async-storage/async-storage — pass anything shaped like { getItem, setItem } (MMKV, SecureStore, your own wrapper). Omit it and the session id just regenerates each app launch.

Screen tracking with React Navigation

This package doesn't depend on @react-navigation/native (not every RN app uses it). If you do, wire attachNavigationTracking to onStateChange:

import { attachNavigationTracking } from "@sightapp/react-native";

<NavigationContainer
  ref={navigationRef}
  onStateChange={() => attachNavigationTracking(navigationRef.current)}
>

Not tested against a live React Navigation app this session — pass your actual navigationRef rather than assuming the helper's minimal type covers every React Navigation version's shape exactly.

Build

npm install
npm run build      # dist/{index.js,index.cjs,index.d.ts}
npm run typecheck

Source repository