Privacy-First Analytics
for React Native
Add analytics to your React Native app in 2 lines of code. No IDFA, no GAID, no device fingerprints. Works with Expo and bare React Native.
import Respectlytics from 'respectlytics-react-native';
// 1. Configure once at app startup
Respectlytics.configure('your-api-key');
// 2. Track events anywhere
Respectlytics.track('purchase_completed');
Installation
Add the SDK to your React Native project in seconds
Option 1: Using npm
npm install respectlytics-react-native @react-native-async-storage/async-storage @react-native-community/netinfo
Option 2: Using Yarn
yarn add respectlytics-react-native @react-native-async-storage/async-storage @react-native-community/netinfo
iOS: Install pods
cd ios && pod install
Android requires no additional setup β autolinking handles everything.
Requirements
Works with Expo
The SDK works with both Expo managed workflow and bare React Native projects.
For Expo, you may need to run expo prebuild to install the native dependencies.
Why Respectlytics for React Native?
Unlike Firebase Analytics, we help you avoid collecting data you don't need
Firebase Analytics
@react-native-firebase/analytics
- β οΈ Collects IDFA/GAID by default
- β οΈ Stores IP addresses
- β οΈ Unlimited custom parameters (PII risk)
- β οΈ Persistent user_id tracking
- π Complex native setup required
Respectlytics
respectlytics-react-native
- β No IDFA, GAID, or device fingerprints
- β IP processed transiently, never stored
- β 5 fields only (API rejects extras)
- β Session-based with 2-hour rotation
- π‘οΈ Simple npm install, no native config
API Reference
Simple by design. Just 3 methods.
| Method | Description |
|---|---|
configure(apiKey: string)
|
Initialize the SDK. Call once in useEffect or app entry
|
track(eventName: string)
|
Track an event. Custom properties not supported (by design) |
flush(): Promise<void>
|
Force send queued events. Rarely neededβSDK auto-flushes every 30s |
Full Example
A complete React Native app with analytics integration
import React, { useEffect } from 'react';
import { View, Button, StyleSheet } from 'react-native';
import Respectlytics from 'respectlytics-react-native';
export default function App() {
useEffect(() => {
// Configure once at app startup
Respectlytics.configure('your-api-key');
}, []);
const handleSignUp = () => {
Respectlytics.track('signup_started');
};
const handlePurchase = () => {
Respectlytics.track('purchase_completed');
};
return (
<View style={styles.container}>
<Button title="Sign Up" onPress={handleSignUp} />
<Button title="Purchase" onPress={handlePurchase} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
gap: 16,
},
});
Automatic Behaviors
The SDK handles these automatically β no developer action needed
Session Management
New session ID on app launch, rotates after 2 hours of use
Event Batching
Events queued and sent in batches (max 10 events or 30 seconds)
Offline Support
Events persisted to AsyncStorage, sent when connectivity returns
Retry Logic
Failed requests retry with exponential backoff (max 3 attempts)
Privacy Architecture
Transparent about exactly what data is collected
β What We Store (5 fields)
-
event_nameThe action being tracked -
timestampWhen it happened -
session_idRAM-only, 2-hour rotation -
platformiOS or Android
Country is derived server-side from IP, then IP is immediately discarded.
β What We DON'T Collect
-
β
IDFA / GAID
Device advertising IDs
-
β
IP addresses
Processed transiently only
-
β
Device fingerprints
No hardware identifiers
-
β
Custom properties
API rejects extra fields
Our motto is Return of Avoidance (ROA) β the best way to protect sensitive data is to never collect it. Consult your legal team to determine your specific requirements.
Frequently Asked Questions
Does the SDK collect IDFA or GAID? βΌ
Does it work with Expo? βΌ
expo prebuild to install the native dependencies
for AsyncStorage and NetInfo.
How do I migrate from Firebase Analytics? βΌ
analytics().logEvent() calls with
Respectlytics.track().
Remove any setUserId() or setUserProperty() calls β Respectlytics uses automatic session-based tracking.
See our migration guide for details.
Does it work offline? βΌ
track() call,
surviving force-quit, crashes, and app termination. Network status is monitored via NetInfo,
and queued events are sent when connectivity is restored.
Why can't I send custom properties? βΌ
What are the peer dependencies? βΌ
@react-native-async-storage/async-storage for offline event queuing
and @react-native-community/netinfo for network status monitoring.
Both are installed automatically with the npm install command.
Other SDKs: Swift β’ Flutter β’ Kotlin β’ Full Documentation
Ready to Add Analytics?
Get started in under 5 minutes. No credit card required.