More in App analytics
- What is the crash-free rate and where do I see it?
- How do I track app versions?
- How do I install the iOS SDK?
- How do I track screen views in my app?
- How do I add TapCub to a Flutter app?
- How do I add TapCub to a React Native app?
- How do I add TapCub to a HarmonyOS app?
- How do I check daily, weekly and monthly active users of my app?
- All guides in this category
Still have a question?
Could not find it? A person reads every message, usually within a few hours on business days.
Chat with usShort answer
Register your app's applicationId under App analytics › Configuration › SDK code, add implementation("com.tapcub:android:0.1.1") to your app module, call TapCub.preInit(this, TapCubConfig(siteKey = "YOUR_SITE_KEY")) in Application.onCreate, and call TapCub.init() once the user has accepted your privacy policy. Launches, Activity screens, clicks and crashes are then collected automatically. Check App analytics › Overview › Realtime for the first $app_start.
The SDK is written in Kotlin and callable from Java, needs minSdk 21, declares only the INTERNET permission and has no AndroidX dependency.
1. Register the app identifier
Open App analytics › Configuration › SDK code and click Add app identifier. Enter your Android applicationId, for example com.example.shop. The SDK sends it with every upload, and data from an identifier that is not registered is dropped silently. The page also prints an install snippet with your site key filled in.
2. Add the dependency
In app/build.gradle.kts:
dependencies {
implementation("com.tapcub:android:0.1.1")
}
The package is on Maven Central. If the snippet in the console prints different coordinates, use those. ProGuard / R8 rules ship inside the AAR, so you do not need to add any.
3. Initialize
class App : Application() {
override fun onCreate() {
super.onCreate()
TapCub.preInit(this, TapCubConfig(siteKey = "YOUR_SITE_KEY"))
}
}
// after the user accepts the privacy policy
TapCub.init()
preInitonly stores the config and binds the lifecycle: no collection, no device reads, no network. It must run inApplication.onCreate, otherwise the cold start and the first screen are lost.initstarts collection. Call it after consent; if your app does not need a consent step, call it right afterpreInit.appId,appVersionandappBuilddefault to the package name,versionNameandversionCode.appIdmust match the identifier you registered.- For China mode, set
region = "cn", callinitafter consent and thenTapCub.grantConsent(listOf("analytics")).
All calls return immediately from any thread; work runs on the SDK's own worker thread.
4. What is collected automatically
| Event | Source | Turn off with |
|---|---|---|
$app_start / $app_end, sessions | Foreground and background | Always on |
$screen_view | Activity onResume; name from @TapCubScreen("Order"), otherwise the class name | autoTrackScreens = false |
$app_click | Deepest clickable view under the tap; text in input fields is never recorded | autoTrack = false |
$app_crashed | Uncaught Java exceptions (reported on next launch); native crashes on Android 11+ | crashReport = false |
$anr | Android 11+, with trace | crashReport = false |
Fragments, Jetpack Compose screens and dialogs are not captured automatically: call TapCub.trackScreen("Home") when they appear. See Track screen views.
5. Send events and identify users
TapCub.track("purchase", mapOf("revenue" to 19.9, "currency" to "USD"))
TapCub.login("USER_ID") // after sign-in
TapCub.setProps(mapOf("plan" to "pro"))
TapCub.logout() // on sign-out
login is ignored when the project is not in identified mode; events still flow. See Identify users.
6. Verify
Run the app on a device or emulator and open App analytics › Overview › Realtime. A start event should appear within seconds. If nothing arrives, check the points below.
Privacy and storage
The event queue is stored in SQLite (8 MB, 10,000 events or 7 days by default), survives restarts and retries with backoff. The device ID is based on ANDROID_ID; no IMEI, MAC, OAID or advertising ID is read. For the Google Play data safety form, declare device or other IDs, app interactions, crash logs and diagnostics.
Troubleshooting
- No data at all: the
applicationIdis not registered, orinitwas never called (for example, consent was not given). - Cold start missing:
preInitruns later thanApplication.onCreate. - Screens missing: Fragment or Compose screens need
trackScreen. - App crashes at start with
siteKey required: the site key is empty. - Stop collection for a user: call
TapCub.optOut();optIn()resumes.
Related
Update history1
- UpdateContent updated
- First published
Did this answer your question?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.