You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Adopture}from'@adopture/react-native';// Initialize once at app startupawaitAdopture.init({appKey: 'ak_your_app_key_here_000000'});// Track eventsAdopture.track('button_pressed',{screen: 'home'});// Track screen viewsAdopture.screen('settings');// Identify users (hashed automatically)awaitAdopture.identify('user-123');
Screen tracking with React Navigation
import{useRef}from'react';import{NavigationContainer,useNavigationContainerRef}from'@react-navigation/native';import{AdoptureProvider,useAdoptureNavigationTracking}from'@adopture/react-native/react';functionAppNavigator(){constnavigationRef=useNavigationContainerRef();useAdoptureNavigationTracking(navigationRef);return(<NavigationContainerref={navigationRef}>{/* your screens */}</NavigationContainer>);}exportdefaultfunctionApp(){return(<AdoptureProviderappKey="ak_your_app_key_here_000000"><AppNavigator/></AdoptureProvider>);}
awaitAdopture.init({appKey: 'ak_your_app_key_here_000000',debug: false,// Enable verbose logging + immediate sendsautoCapture: true,// Track lifecycle events automaticallyflushIntervalMs: 30000,// Send batches every 30sflushAt: 20,// Send when 20 events are queuedmaxQueueSize: 1000,// Max events stored locallyhashUserIds: true,// Hash user IDs before sendingappVersion: '1.2.0',// Override auto-detected version});
Super properties
Attach properties to every event:
// Set global propertiesawaitAdopture.registerSuperProperties({app_variant: 'premium',build: 'production',});// Set only if not already setawaitAdopture.registerSuperPropertiesOnce({first_open_date: newDate().toISOString(),});// Remove a propertyawaitAdopture.unregisterSuperProperty('build');// Clear allawaitAdopture.clearSuperProperties();