How We Built User Interaction Tracking For Jetpack Compose
Article Summary
Markus Hintersteiner from Sentry reveals how they cracked a tricky problem: tracking user interactions in Jetpack Compose without cluttering developers' code or killing performance.
The Sentry team built automatic user interaction tracking for Jetpack Compose as part of their open-source Android SDK. This deep dive shows how they navigated Compose's internal APIs, avoided accessibility overhead, and delivered a feature that works out-of-the-box with minimal setup.
Key Takeaways
- Used Window.Callback to intercept all touch events globally without code changes
- Avoided accessibility APIs due to 100ms sync overhead and performance concerns
- Accessed internal Compose APIs via Java to bypass Kotlin compiler restrictions
- Leveraged existing Modifier.testTag for UI element identification in release builds
Critical Insight
Sentry shipped automatic Compose interaction tracking in SDK 6.10.0 by cleverly combining Window callbacks, LayoutNode traversal, and semantic modifiers without requiring reflection or accessibility services.