Android Analytics SDK Setup: Kotlin Events Without PII
Set up Android analytics with a Kotlin SDK, test mode, Maven dependency, safe payload keys, and privacy-first event instrumentation.
Summary
A Kotlin setup guide for Android teams adding analytics while avoiding personal data in event payloads.
Configure analytics in Application.onCreate.
Use mavenCentral and a stable package coordinate.
Apply consent before automatic launch tracking and keep payloads consistent with iOS.
Configure the SDK in the Application class
Android analytics should be configured once in Application.onCreate before feature screens begin tracking. Apply collectionEnabled and automaticAppLaunchTracking from the app's consent state so configuration does not collect before the user choice your app requires.
Use test mode during development and internal app sharing, but remember that it does not bypass consent. If you are testing against a local server in the Android emulator, localhost points at the emulator rather than your development computer. Use the emulator host alias or a deployed endpoint.
Use the same taxonomy as iOS
Cross-platform teams should not invent separate Android event names. App.launch, Onboarding.completed, Paywall.viewed, Purchase.completed, and Error.occurred should mean the same thing on both platforms.
Consistent naming makes dashboards and funnels much easier to trust. It also reduces the cost of adding alerts and exports later.
Protect users by default
Android apps often have access to identifiers and device context that analytics does not need. Block risky keys, avoid advertising IDs, and never send precise location unless the analytics question truly requires it and the user has granted appropriate consent.
A privacy-safe SDK should perform client-side filtering and a server-side ingest check. Defense in depth matters because instrumentation changes happen quickly during product launches.
FAQ
Common questions
Where should Android analytics be initialized?
Initialize analytics in Application.onCreate so events can be tracked consistently across activities and screens.
Should Android and iOS event names match?
Yes. Matching event names across platforms makes funnel, retention, and revenue dashboards comparable.