Skip to main content
For React Native applications, we provide a comprehensive SDK that enables seamless data collection with rich native context. This SDK automatically collects 30+ device and app data points while maintaining privacy compliance and optimal performance.

Installation

Step 1: Install Package & Dependencies

npm install react-native-edgee @react-native-async-storage/async-storage @react-native-community/netinfo

Step 2: Platform Setup

Choose your platform setup based on your React Native environment:
iOS:
cd ios && pod install && cd ..
Android:
  1. Add native module to android/app/src/main/java/.../MainApplication.java:
import com.reactnativeedgee.EdgeeReactNativePackage;

public class MainApplication extends Application implements ReactApplication {
  // ... existing code ...

  @Override
  protected List<ReactPackage> getPackages() {
    @SuppressWarnings("UnnecessaryLocalVariable")
    List<ReactPackage> packages = new PackageList(this).getPackages();

    packages.add(new EdgeeReactNativePackage()); // 👈 Add this line

    return packages;
  }
}
  1. Add permission to android/app/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Your existing manifest content -->
</manifest>
  1. Rebuild your app:
npx react-native run-android

Step 3: Verify Installation

Test that native modules are working:
import { isNativeModuleAvailable } from 'react-native-edgee';

console.log('Native modules available:', isNativeModuleAvailable());
// Should log: true (React Native CLI, Expo Dev Build)
// Should log: false (Expo Go)

Quick Start

import { EdgeeClient } from 'react-native-edgee';

// Create client instance
export const edgee = new EdgeeClient({
  host: "https://your-edgee-host.com",
  debug: false, // Set to true to enable debug logging and debugger in the Edgee console
  collectDeviceId: false, // Set to true if you need unique device tracking
});
Replace https://your-edgee-host.com with the URL provided in the Edgee console, in the project overview section.

Events

- Screen event

The edgee.screen() method expect the following parameters:
fieldtypedescription
screen_obj (required)objectA free-form dictionary object containing properties of the screen event. This object has to include the screen_name field, and can include the screen_class and properties fields.
components (optional)objectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.
Here is an example of a complete edgee.screen() call:
// Track screen views
edgee.screen({
  screen_name: 'Home Screen',
  screen_class: '/',
  properties: {
    category: 'main',
    loaded_time: Date.now()
  }
});

- Track event

The edgee.track() method expect the following parameters:
fieldtypedescription
track_obj (required)objectA free-form dictionary object containing properties of the track event. This object has to include the name field, and can include the screen_name and screen_class fields, and the properties field.
components (optional)objectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.
Here is an example of a complete edgee.track() call:
// Track events (automatically includes rich native context)
edgee.track({
  name: 'App Launched',
  screen_name: 'Home Screen',
  screen_class: '/',
  properties: {
    source: 'cold_start',
    version: '1.0.0'
  }
});

- User event

The edgee.user() method expect the following parameters:
fieldtypedescription
user_obj (required)objectA free-form dictionary object containing properties of the user event. This object has to include the user_id field, and can include the properties field.
components (optional)objectSpecifies which analytics components should receive the event data. This allows for targeted data sending based on your configured components within the Edgee platform.
Here is an example of a complete edgee.user() call:
// Track user information
edgee.user({
  user_id: '123',
  properties: {
    email: '[email protected]',
    plan: 'premium'
  }
});
To define the consent status, you can use the edgee.consent() method.
// Set consent - all tracking calls automatically respect this setting
// 'granted', 'denied', or 'pending'
await edgee.consent('granted'); // 'granted', 'denied', or 'pending'

// Check consent status
console.log('Current consent:', edgee.getConsent());

// Listen for consent changes
const unsubscribe = edgee.onConsentChange((status) => {
  console.log('Consent changed to:', status);
});

// Reset consent
await edgee.resetConsent();

Configuration

interface EdgeeConfig {
  host: string;                    // Your Edgee endpoint URL (required)
  debug?: boolean;                 // Enable debug logging (default: false)
  collectDeviceId?: boolean;       // Collect unique device ID (default: false)
  cookieName?: string              // Name of the cookie used by Edgee (it must be identical to the one on the console. Do not change it if you are unsure).
}

Debug Mode

Enable debug logging to see what’s happening:
const edgee = new EdgeeClient({
  host: "https://your-edgee-host.com",
  debug: true, // This will log all events and native context
});

Compatibility

PlatformVersionNative ContextAuto-Linking
React Native0.72+✅ FulliOS: ✅ Android: Manual
iOS11.0+✅ Full✅ CocoaPods
AndroidAPI 21+✅ Full⚠️ Manual setup
Expo Dev BuildLatest✅ Full✅ Automatic
Expo GoLatest⚠️ FallbackN/A

Next Steps

After integrating the React Native SDK, you’re ready to start using Edgee’s services. In the Services section, you’ll find comprehensive guides on activating and customizing features such as advanced analytics, A/B testing, security, and more, ensuring your mobile application not only performs efficiently but also delivers a superior user experience. For more details about the React Native SDK, visit the react-native-edgee repository.