appvibezz
v1.0.9
Published
AppVibezz Unified Analytics Tracker for React Native and Web
Maintainers
Readme
AppVibezz SDK
The official tracking SDK for AppVibezz — Mobile Measurement Platform.
Track user events, measure attribution, analyze retention and revenue across iOS, Android, and Web platforms.
Installation
npm install appvibezz
# or
yarn add appvibezzReact Native (Additional Step)
npm install @react-native-async-storage/async-storageQuick Start
1. Initialize the SDK
Call init() once when your app starts. You'll find your API Key in the AppVibezz Dashboard under API Keys.
import { AppVibezz } from 'appvibezz';
AppVibezz.init({
apiKey: 'YOUR_API_KEY',
});That's it! The SDK will automatically track:
- 📱 First Open — When the app is installed and opened for the first time
- 🔄 App Open — When the user returns to the app after 30+ minutes
2. Identify Users
After your user logs in, call identify() to link events to their profile:
AppVibezz.identify('user_12345');3. Track Events
Track any custom event with optional properties:
// Simple event
AppVibezz.track('sign_up');
// Event with properties
AppVibezz.track('add_to_cart', {
item_id: 'SKU_123',
price: 29.99,
category: 'electronics',
});4. Track Revenue
Use the built-in revenue() method for purchase events:
AppVibezz.revenue(9.99, 'USD', {
product_id: 'premium_monthly',
transaction_id: 'txn_abc123',
});5. Track Screens
// Manual screen tracking
AppVibezz.screen('HomeScreen');
AppVibezz.screen('ProductDetail', { product_id: '123' });React Navigation (Auto-Track)
import { useRef } from 'react';
import { NavigationContainer } from '@react-navigation/native';
function App() {
const navigationRef = useRef(null);
return (
<NavigationContainer
ref={navigationRef}
onReady={() => AppVibezz.trackNavigation(navigationRef)}
>
{/* Your screens */}
</NavigationContainer>
);
}6. User Properties
Set custom properties on the current user:
AppVibezz.setUserProperty('plan', 'premium');
AppVibezz.setUserProperty('age', 28);7. Advertising ID (IDFA / GAID)
For attribution, pass the advertising ID after requesting permission:
AppVibezz.setAdvertisingId('00000000-0000-0000-0000-000000000000');8. Logout / Reset
When the user logs out, reset the SDK state:
await AppVibezz.reset();Configuration Options
AppVibezz.init({
apiKey: 'YOUR_API_KEY', // Required
endpoint: 'https://...', // Custom endpoint (optional)
flushInterval: 5000, // Queue flush interval in ms (default: 5000)
maxBatchSize: 50, // Max events per batch (default: 50)
sessionTimeout: 1800000, // Session timeout in ms (default: 30 min)
autoTrack: true, // Auto first_open/app_open (default: true)
debug: false, // Console logging (default: false)
storage: customStorage, // Custom StorageAdapter (optional)
});React Native Setup
For React Native apps, pass AsyncStorage as the storage adapter for persistent offline queue:
import { AppVibezz } from 'appvibezz';
import AsyncStorage from '@react-native-async-storage/async-storage';
AppVibezz.init({
apiKey: 'YOUR_API_KEY',
storage: AsyncStorage,
});Custom Storage Adapter
You can use any storage backend that implements getItem and setItem:
import { MMKV } from 'react-native-mmkv';
const storage = new MMKV();
AppVibezz.init({
apiKey: 'YOUR_API_KEY',
storage: {
getItem: (key) => storage.getString(key) || null,
setItem: (key, value) => storage.set(key, value),
},
});How It Works
- Events are added to an in-memory queue (no main thread blocking)
- Queue is persisted to storage (survives app crashes & restarts)
- Events are flushed in batches every 5 seconds or when batch is full
- Failed requests are retried automatically (network errors, rate limits)
Platform Support
| Platform | Status | |----------|--------| | React Native (iOS) | ✅ | | React Native (Android) | ✅ | | Web (Browser) | ✅ | | Node.js (Server) | ✅ | | Expo | ✅ |
API Reference
| Method | Description |
|--------|-------------|
| AppVibezz.init(config) | Initialize the SDK |
| AppVibezz.identify(userId) | Set the user ID |
| AppVibezz.track(event, props?) | Track a custom event |
| AppVibezz.screen(name, props?) | Track a screen view |
| AppVibezz.revenue(amount, currency?, props?) | Track a purchase |
| AppVibezz.setUserProperty(key, value) | Set a user property |
| AppVibezz.setAdvertisingId(id) | Set IDFA/GAID |
| AppVibezz.trackNavigation(ref) | Auto-track React Navigation |
| AppVibezz.flush() | Force flush queued events |
| AppVibezz.reset() | Clear user state (logout) |
| AppVibezz.shutdown() | Stop SDK & flush remaining events |
License
MIT
