FAQ
Common questions about React Native integration, testing, event tracking, and troubleshooting.
Integration
How do I add the React Native SDK?
Install the package from npm:
npm install react-native-adtrace --save
If you hit linking or dependency resolution issues, try Yarn instead:
yarn add react-native-adtrace
For iOS, install CocoaPods dependencies after adding the package:
cd ios && pod install
See the full walkthrough in Basic Setup.
Where should I initialize the SDK?
Initialize Adtrace once at the root of your app — for example in App.js or your top-level component — so it runs whenever the app opens:
import { AdTrace, AdTraceConfig } from 'react-native-adtrace';
const adtraceConfig = new AdTraceConfig('{YourAppToken}', AdTraceConfig.EnvironmentSandbox);
AdTrace.create(adtraceConfig);
Call AdTrace.componentWillUnmount() when the root component unmounts. Avoid creating multiple config instances or calling AdTrace.create() from nested screens; always use the same entry point.
Do I need native setup as well as JavaScript?
Yes. The React Native SDK wraps the native Android and iOS SDKs. After installing the npm package, complete the platform steps in Basic Setup — Android permissions, Google Play Services, install referrer, iOS frameworks, and pod install for iOS.
Testing
Why don't I see data in the panel?
| Cause | Fix |
|---|---|
| Environment mismatch | Use AdTraceConfig.EnvironmentSandbox while testing. In the panel, switch to sandbox traffic view — production is shown by default. |
| Device already tracked | Use a fresh device or Forget Device in the panel before retesting install. |
| Install not recorded yet | Events are stored but not shown in statistics until install succeeds. Confirm install first. |
| Incomplete native setup | Verify both JS initialization and native steps (permissions, Play Services, pods). |
| Log level too low | Set adtraceConfig.setLogLevel(AdTraceConfig.LogLevelVerbose) and watch device logs for adid and gps_adid. |
Follow Test the integration for Testing Console steps.
What should I look for in logs?
Run the app in sandbox with verbose logging. After the first session, verbose output should include device identifiers such as adid (Adtrace device ID) and, on Android with Play Services configured, gps_adid. Missing IDs usually point to native configuration gaps — see Basic Setup.
Event tracking
How do I track events?
Define event tokens in the panel, then track them with AdTraceEvent:
import { AdTrace, AdTraceEvent } from 'react-native-adtrace';
const adtraceEvent = new AdTraceEvent('abc123');
adtraceEvent.addCallbackParameter('key', 'value');
AdTrace.trackEvent(adtraceEvent);
See Event Tracking for revenue, callback parameters, and partner parameters.
Why do events not appear in the panel?
Install must be recorded on the device first. Adtrace receives and stores events before install, but they will not appear in panel statistics until install is tracked. Confirm install in verbose logs or the Testing Console, then send events again.
For revenue events, provide a unique order or transaction ID when applicable to prevent duplicate counting.
Troubleshooting
Package or native build failures
| Symptom | Fix |
|---|---|
| Module not found / linking errors | Clean caches: delete Android build folders, run cd ios && pod deintegrate && pod install, reinstall node_modules. Try yarn if npm fails. |
| iOS build issues after SDK add | Ensure pod install ran in ios/. Check that required iOS frameworks are linked as Optional per Basic Setup. |
Android gps_adid missing in logs | Add Google Play Services analytics dependency and AD_ID permission. See Basic Setup. |
| Install works in sandbox, not production | Check ProGuard/R8 rules. Add keep rules from Basic Setup. |
| Huawei devices missing install referrer | Add the OAID plugin — see OAID setup. |
General checklist
- SDK initialized once at app root with a valid app token and correct environment.
- Sandbox + verbose logs enabled during development.
- Fresh device or Forget Device before retesting install.
- Panel set to sandbox traffic when testing sandbox builds.
- Native Android/iOS requirements completed (permissions, Play Services, install referrer, pods).
For persistent issues, compare your setup with the example app or contact Adtrace support.