Installation
Standard React Native
Install the package
npm
npm install @attributehq/react-native-sdkInstall iOS pods
cd ios && pod install && cd ..Rebuild the app
npx react-native run-ios
# or
npx react-native run-androidYou 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-sdkAdd 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 allConfig Plugin Options
| Option | Type | Default | Description |
|---|---|---|---|
enableAdIdPermission | boolean | true | Add AD_ID permission to Android manifest |
trackingPermissionText | string | Default text | iOS 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
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | Required. API key from dashboard |
appId | string | — | Required. App UUID from dashboard |
enableDebugLogging | boolean | false | Enable native debug logs |
batchSize | number | 10 | Events per batch |
flushInterval | number | 5 | Seconds between auto-flush |
maxQueueSize | number | 100 | Max events in queue |
requestATTOnInit | boolean | true | iOS: auto-request ATT |
attDelaySeconds | number | 0 | iOS: delay before ATT prompt |