Expo
High-performance real-time analytics for Expo applications. Track users, sessions, and events | FlowAlive Analytics
Installation
Install the SDK
npm install flowalive-analyticsbun add flowalive-analyticsyarn add flowalive-analyticspnpm add flowalive-analyticsInstall Required Peer Dependencies
FlowAlive requires standard Expo modules for storage, network, and device detection:
npx expo install @react-native-async-storage/async-storage @react-native-community/netinfo expo-device expo-localization expo-routerbunx expo install @react-native-async-storage/async-storage @react-native-community/netinfo expo-device expo-localization expo-routeryarn dlx expo install @react-native-async-storage/async-storage @react-native-community/netinfo expo-device expo-localization expo-routerpnpm dlx expo install @react-native-async-storage/async-storage @react-native-community/netinfo expo-device expo-localization expo-routerThese dependencies are required for the SDK to work correctly. The SDK uses:
@react-native-async-storage/async-storage- Local storage for offline event queuing@react-native-community/netinfo- Network state monitoringexpo-device- Device information collectionexpo-localization- Locale and timezone detectionexpo-router- Automatic screen tracking
Get Your API Key
- Sign in to your Flowalive
- Select your Project and go to Settings > API Keys
- Copy your API Key (starts with
flowalive_)
Setup
Wrap your application with the FlowaliveProvider in your root layout app/_layout.tsx initialize the real-time engine:
import { FlowaliveProvider } from 'flowalive-analytics/expo';
export default function RootLayout() {
return (
<FlowaliveProvider
apiKey="flowalive_xxx"
>
<Stack />
</FlowaliveProvider>
);
}Configuration
The FlowaliveProvider component accepts the following props:
Prop
Type
Usage
Set Device
import { Flowalive } from 'flowalive-analytics/expo';
import { useEffect } from 'react';
export default function App() {
useEffect(() => {
// Initialize analytics - no PII collected by default
Flowalive.setDevice();
}, []);
return <YourApp />;
}Privacy by default:
- No personal data is collected without explicit properties
- Device ID is auto-generated and stored locally
- Only technical metadata is collected (OS version, platform, locale, appUserName, appUserEmail, appUserId)
Adding custom properties:
You can optionally attach user properties. Important: If you add PII (personally identifiable information), ensure you have proper user consent:
// After user login and consent
await Flowalive.setDevice({
appUserId: '123',
appUserName: 'John Doe',
appUserEmail: [EMAIL_ADDRESS]',
metadata:{
plan: 'premium',
beta_tester: true
}
});Properties must be primitives: string, number, boolean, or null.
Track Events
// Event without parameters
Flowalive.track('app_opened');
// Event with parameters
Flowalive.track('purchase_completed', {
amount: 99.99,
currency: 'USD',
product_id: 'premium_plan'
});Event naming rules:
- Alphanumeric characters, underscores (
_), hyphens (-), periods (.), forward slashes (/), and spaces - 1-256 characters
- Examples:
purchase,user.signup,payment/success,Button Clicked
Event parameters:
- Must be primitives:
string,number,boolean, ornull
Automatic Screen Tracking
Enable automatic screen tracking by setting trackNavigation to true in your root layout. The SDK uses Expo Router's navigation hooks to track screen changes automatically:
import { FlowaliveProvider } from 'flowalive-analytics/expo';
import { Stack } from 'expo-router';
export default function RootLayout() {
return (
<FlowaliveProvider
apiKey="flowalive_xxx"
trackNavigation={true}
>
<Stack />
</FlowaliveProvider>
);
}How it works:
- Wraps any Expo Router component (
Stack,Tabs,Drawer, etc.) - Automatically tracks screen views on route changes
- Screen names are derived from pathname
- Works with nested routes and dynamic segments
No additional setup required, just wrap your navigation structure with FlowaliveProvider.
Type Reference
DeviceProperties
Prop
Type
EventParams
Event parameters passed to Flowalive.track():
Prop
Type
How It Works
Offline Support
Events are queued locally using @react-native-async-storage/async-storage when offline. The queue automatically syncs when connection is restored.
Performance
- Offline events are batched and sent asynchronously
- Network state is monitored via
@react-native-community/netinfo - Failed requests retry with exponential backoff
- Maximum batch size: 1000 events
