Sources & SDKs
Mobile SDK setup
Overview
Mobile SDKs batch events while the app is foregrounded, respects OS privacy prompts, and forwards deep links for attribution stitching. Install the vendor package, configure the workspace key from secure storage, and align event names with your server taxonomy.
Steps
- Add the TrackLayer mobile package to your Gradle, SPM, or CocoaPods manifest.
- Initialize inside
Application/AppDelegatewith environment flags (productionvssandbox). - Forward lifecycle hooks (
applicationDidBecomeActive) so sessions stay accurate.
TrackLayer.configure(apiKey: ProcessInfo.processInfo.environment["TRACKLAYER_KEY"]!)
TrackLayer.shared.track("AppOpen", properties: ["version": Bundle.main.appVersion])- Use the debug console to force a flush during QA.
Troubleshooting
- Missing events after backgrounding: enable background fetch only when policies allow; otherwise accept longer flush intervals offline.
- IDFA gaps: gate tracking behind ATT prompts and fall back to first-party identifiers from your auth layer.
- Duplicate purchases often come from client retries—dedupe with server-generated
event_idvalues pushed to the client on confirmation.