SDKsReact Native
Configuration
Configure the Adopture React Native SDK with custom options.
Full Configuration
Pass options when initializing the SDK:
import { AdoptureProvider } from '@adopture/react-native/react';
<AdoptureProvider
appKey="ak_your_app_key_here"
options={{
debug: false,
autoCapture: true,
flushIntervalMs: 30000,
flushAt: 20,
maxQueueSize: 1000,
hashUserIds: true,
appVersion: '1.2.0',
}}
>
<App />
</AdoptureProvider>Or with the imperative API:
await Adopture.init({
appKey: 'ak_your_app_key_here',
debug: false,
autoCapture: true,
flushIntervalMs: 30000,
flushAt: 20,
maxQueueSize: 1000,
hashUserIds: true,
appVersion: '1.2.0',
});Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
appKey | string | — | Required. Your app key from the Adopture dashboard. Format: ak_ followed by 24 alphanumeric characters. |
apiEndpoint | string | https://api.adopture.com | API endpoint URL. Only change this for self-hosted setups. |
debug | boolean | false | Enable verbose console logging and send events immediately instead of batching. |
autoCapture | boolean | true | Automatically track lifecycle events (app_installed, app_updated, app_opened, app_backgrounded, session_start). |
flushIntervalMs | number | 30000 | How often to send batched events, in milliseconds. |
flushAt | number | 20 | Send events when this many are queued. Range: 1–100. |
maxQueueSize | number | 1000 | Maximum number of events stored locally. Oldest events are evicted first when the limit is reached. |
hashUserIds | boolean | true | Hash user IDs with SHA-256 before sending. Disable only if you need raw IDs on the server. |
appVersion | string | Auto-detected | Override the auto-detected app version. If not set, the SDK reads it from expo-constants when available. |
Debug Mode
Enable debug mode during development to see all SDK activity in the console:
<AdoptureProvider appKey="ak_..." options={{ debug: true }}>In debug mode:
- All events are logged to the console with
[Adopture]prefix - Events are sent immediately instead of being batched
- Device context details are logged on initialization
Turn off debug mode before releasing to production.
API Endpoint
The default endpoint (https://api.adopture.com) works for all Adopture cloud users. Only change this if you're running a self-hosted instance:
<AdoptureProvider
appKey="ak_..."
options={{ apiEndpoint: 'https://analytics.yourdomain.com' }}
>