Skip to Content

Installation

Standard React Native

Install the package

npm install @attributehq/react-native-sdk

Install iOS pods

cd ios && pod install && cd ..

Rebuild the app

npx react-native run-ios # or npx react-native run-android

You must rebuild the native app after installing. The SDK contains native code that is not available until the app is recompiled.

Expo (EAS Build)

Install the package

npx expo install @attributehq/react-native-sdk

Add the config plugin

In app.json or app.config.js:

{ "expo": { "plugins": [ ["@attributehq/react-native-sdk", { "enableAdIdPermission": true, "trackingPermissionText": "We use this to measure ad performance and attribute app installs." }] ] } }

Build with EAS

eas build --platform all

Config Plugin Options

OptionTypeDefaultDescription
enableAdIdPermissionbooleantrueAdd AD_ID permission to Android manifest
trackingPermissionTextstringDefault textiOS NSUserTrackingUsageDescription text

The config plugin automatically adds required Android permissions and the iOS ATT usage description. No manual Info.plist or AndroidManifest.xml edits needed.

Initialize the SDK

import { useEffect } from 'react' import { AttributeHQ } from '@attributehq/react-native-sdk' export default function App() { useEffect(() => { const init = async () => { try { await AttributeHQ.initialize({ apiKey: 'ak_your_api_key', appId: 'your-app-uuid', enableDebugLogging: true, }) console.log('AttributeHQ initialized') } catch (error) { console.error('Init failed:', error) } } init() }, []) return <YourApp /> }

initialize() is the only async setup method. It must be awaited before calling other methods.

Configuration Options

OptionTypeDefaultDescription
apiKeystringRequired. API key from dashboard
appIdstringRequired. App UUID from dashboard
enableDebugLoggingbooleanfalseEnable native debug logs
batchSizenumber10Events per batch
flushIntervalnumber5Seconds between auto-flush
maxQueueSizenumber100Max events in queue
requestATTOnInitbooleantrueiOS: auto-request ATT
attDelaySecondsnumber0iOS: delay before ATT prompt