React Native SDK for Ingestia — behavioral event analytics.
- React Native 0.74+
- iOS 15+
- Android API 24+
npm install @ingestia/react-native
# or
yarn add @ingestia/react-nativecd ios && pod installNo additional steps required.
Create a client and wrap your app with IngestiaProvider:
import { IngestiaClient, IngestiaProvider } from '@ingestia/react-native';
const client = new IngestiaClient({
apiKey: 'your-api-key',
endpoint: 'https://your-ingestia-backend:50051',
});
export default function App() {
return (
<IngestiaProvider client={client}>
<YourApp />
</IngestiaProvider>
);
}Use useIngestia() anywhere inside IngestiaProvider:
import { useIngestia } from '@ingestia/react-native';
function HomeScreen() {
const { track, identify, initialize, flush, destroy } = useIngestia();
useEffect(() => {
initialize();
}, []);
return (
<Button
title="Buy"
onPress={() => track('purchase_clicked', { item: 'pro_plan' })}
/>
);
}new IngestiaClient(config: IngestiaConfig)| Option | Type | Default | Description |
|---|---|---|---|
apiKey |
string |
required | Project API key |
endpoint |
string |
http://localhost:50051 |
Backend gRPC endpoint |
flushInterval |
number |
5000 |
Auto-flush interval in ms |
batchSize |
number |
10 |
Events per batch before auto-flush |
Returns an object with the following methods:
| Method | Signature | Description |
|---|---|---|
initialize |
() => Promise<void> |
Load or generate anonymous user ID, send identify event |
track |
(event: string, properties?: Record<string, unknown>) => void |
Queue a track event |
identify |
(userId: string, traits?: Record<string, unknown>) => void |
Queue an identify event |
flush |
() => Promise<void> |
Flush queued events immediately |
destroy |
() => void |
Stop auto-flush timer |
Returns the raw IngestiaClient instance for direct access:
import { useIngestiaClient } from '@ingestia/react-native';
const client = useIngestiaClient();MIT