Adopture Docs
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

OptionTypeDefaultDescription
appKeystringRequired. Your app key from the Adopture dashboard. Format: ak_ followed by 24 alphanumeric characters.
apiEndpointstringhttps://api.adopture.comAPI endpoint URL. Only change this for self-hosted setups.
debugbooleanfalseEnable verbose console logging and send events immediately instead of batching.
autoCapturebooleantrueAutomatically track lifecycle events (app_installed, app_updated, app_opened, app_backgrounded, session_start).
flushIntervalMsnumber30000How often to send batched events, in milliseconds.
flushAtnumber20Send events when this many are queued. Range: 1–100.
maxQueueSizenumber1000Maximum number of events stored locally. Oldest events are evicted first when the limit is reached.
hashUserIdsbooleantrueHash user IDs with SHA-256 before sending. Disable only if you need raw IDs on the server.
appVersionstringAuto-detectedOverride 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' }}
>

On this page