Respectlytics Respect lytics
Menu
React Native SDK v2.1.0

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.

App.tsx
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');
2 lines
to integrate
5 fields
stored only
TypeScript
built-in types
0 device IDs
collected

Installation

Add the SDK to your React Native project in seconds

Option 1: Using npm

Terminal
npm install respectlytics-react-native @react-native-async-storage/async-storage @react-native-community/netinfo

Option 2: Using Yarn

Terminal
yarn add respectlytics-react-native @react-native-async-storage/async-storage @react-native-community/netinfo

iOS: Install pods

Terminal
cd ios && pod install

Android requires no additional setup β€” autolinking handles everything.

Requirements

βœ“ React Native 0.70+
βœ“ iOS 15.0+
βœ“ Android API 21+
βœ“ Node.js 16+
βœ“ TypeScript support
βœ“ Expo compatible
🎯

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

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

App.tsx
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_name The action being tracked
  • timestamp When it happened
  • session_id RAM-only, 2-hour rotation
  • platform iOS 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? β–Ό
No. The Respectlytics React Native SDK never collects IDFA, GAID, device fingerprints, or any persistent identifiers. Session IDs are stored only in RAM and rotate every 2 hours or on app restart.
Does it work with Expo? β–Ό
Yes! 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 for AsyncStorage and NetInfo.
How do I migrate from Firebase Analytics? β–Ό
Replace your 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? β–Ό
Yes. Events are immediately persisted to AsyncStorage on every 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? β–Ό
By design. Custom properties are the #1 source of accidental PII leaks in analytics. Our API rejects any fields not on the strict 4-field allowlist, making it technically difficult to accidentally collect data you don't need. Read why we killed custom properties.
What are the peer dependencies? β–Ό
The SDK requires @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.