@founderhq/events-react-native
v0.6.0
Published
FounderHQ Events SDK for React Native and Expo
Readme
@founderhq/events-react-native
FounderHQ Events for React Native and Expo. The SDK persists queue, identity, consent, super properties, and sessions with AsyncStorage; captures AppState lifecycle automatically; and includes React Navigation and Expo Router helpers.
import { FounderHqReactNativeClient, createReactNavigationTracker } from "@founderhq/events-react-native";
const events = new FounderHqReactNativeClient("fhq_pk_...");
events.capture("signup.completed");Install account context at construction when the first automatic event must
already carry it. The same API is available from the /expo export:
const events = new FounderHqReactNativeClient("fhq_pk_...", {
account: { key: "workspace_123", properties: { plan: "growth" } },
});
await events.identifyAndWait("person_123", {}, {
account: { key: "workspace_123" },
});
events.setAccount("workspace_456");
events.setAccountProperties({ employeeBand: "11-50" });
events.clearAccount(); // resetAccounts() is an alias for logout flowsAccount changes rotate an app-scoped account span, not the person session.
Queued events retain the account snapshot they were captured with, and
reset() clears identity plus account context.
Requests use property-only protocol v2 at POST /i/v2/e. Sessions are UUIDv7,
every $screen has a $screen_id, and screen/viewport dimensions are physical
pixels. Automatic app/device/OS facts use the canonical $ taxonomy; deep
links recognize all 24 unprefixed campaign properties.
Clock, UUIDv7, storage, transport, and platform facts are injectable. The test
suite consumes the shared capability matrix, executes every applicable fixture
action exactly, and compares every captured v2 request plus normalized
persistence/directive state to its canonical golden. Remote config can disable
and re-arm mobile session, screen, and application-lifecycle capture. It is
fetched with the publishable key from GET /i/v1/analytics/config, cached in
the injected storage, and can be refreshed with refreshRemoteConfig();
disable fetching with remote_config: false.
