Skip to main content

Configuration — React Native SDK

Pass options via OpenCDPConfig in OpenCDPSDK.initialize({ config }).

Core​

FieldTypeDefaultDescription
cdpApiKeystringrequiredWorkspace API key
cdpEndpointstringhttps://api.opencdp.io/gateway/data-gatewayPrimary data-gateway base URL
cdpFallbackEndpointsstring[]https://api.open-cdp.com/gateway/data-gateway, https://api.open-cdp.xyz/gateway/data-gatewayFailover gateway base URLs, tried in order after the primary
cdpRequestTimeoutnumber30000Per-host wait in milliseconds (30 seconds). Values outside 5000–120000 are clamped to that range.
debugbooleanfalseVerbose SDK logging
throwErrorsBackbooleanfalseThrow on validation/API errors

Tracking​

FieldDefaultDescription
autoTrackScreensfalseNative screen auto-tracking
trackApplicationLifecycleEventsfalseApp foreground/background events
autoTrackDeviceAttributesfalseRegister device on init when token available

In-app​

FieldDefaultDescription
enableInAppMessagesfalseAutomatic in-app delivery
enableInAppRealtimefalseSSE realtime sync
inAppSyncLimit10Max messages per sync

Customer.io dual-write​

FieldDescription
sendToCustomerIoMirror identify/track/register to Customer.io
customerIo / customerIoConfigCustomer.io credentials (native passthrough)

Gateway request timeout​

cdpRequestTimeout is in milliseconds. The built-in default is 30000 (30 seconds). The SDK clamps any value below 5000 up to 5 seconds, and any value above 120000 down to 120 seconds.

The timeout is how long the SDK waits for one gateway host to answer a single request. On a timeout, a network error, or a non-success status, the SDK tries the next host immediately:

  1. https://api.opencdp.io/gateway/data-gateway
  2. https://api.open-cdp.com/gateway/data-gateway
  3. https://api.open-cdp.xyz/gateway/data-gateway

Leave cdpRequestTimeout unset to keep the 30 second default. To wait 20 seconds on each host, pass 20000.

Example​

await OpenCDPSDK.initialize({
config: {
cdpApiKey: 'YOUR_CDP_API_KEY',
cdpEndpoint: 'https://api.opencdp.io/gateway/data-gateway',
cdpRequestTimeout: 20000, // 20 seconds per host
debug: true,
throwErrorsBack: true,
autoTrackDeviceAttributes: true,
enableInAppMessages: true,
enableInAppRealtime: true,
inAppSyncLimit: 10,
},
shouldReinitialize: false,
});