Track Jetpack Compose Screens with Appxiom
Appxiom SDK provides comprehensive tracking of Jetpack Compose screen lifecycle events in Android applications. By integrating Appxiom's navigation and back stack observation APIs, you can monitor user navigation, screen transitions, and lifecycle events for actionable analytics and troubleshooting. This helps you optimize user experience and gain deep insights into Compose-based UI flows.
How to Enable Jetpack Compose Screen Tracking
- Pass your
navigationControllerobject toAxNavigationControllerto start tracking navigation events. - Call
AxThisNavBackStackEntrywithin each screen composable in yourNavHostto capture lifecycle events for every screen.
After setup, all lifecycle events of your Jetpack Compose screens will be recorded and available in the ActivityTrail for analysis.
Example: Kotlin Implementation
val navigationController = rememberNavController()
NavHost(navController = navigationController, startDestination = "HomeScreen") {
composable("HomeScreen") {
HomeScreen()
AxThisNavBackStackEntry()
}
composable("ProfileScreen") {
ProfileScreen()
AxThisNavBackStackEntry()
}
composable("SettingsScreen") {
SettingsScreen()
AxThisNavBackStackEntry()
}
}
AxNavigationController(navController = navigationController)
Frequently Asked Questions (FAQs)
Q: How does Appxiom track Jetpack Compose screens?
A: Appxiom uses AxNavigationController to monitor navigation events and AxThisNavBackStackEntry to capture lifecycle events for each screen in your NavHost. This enables detailed analytics on user journeys and screen transitions in Compose-based Android apps.
Q: Where should I place AxThisNavBackStackEntry in my code?
A: Call AxThisNavBackStackEntry inside each composable function that represents a screen within your NavHost. This ensures Appxiom captures lifecycle events for every screen.
Q: Is Jetpack Compose tracking compatible with custom navigation setups?
A: Appxiom's tracking works with any navigation pattern that uses NavHost and a navigationController. For custom navigation, ensure these components are present for full compatibility.
Q: How can I view the tracked Compose screen events?
A: All tracked lifecycle and navigation events are available in the ActivityTrail section of any issue reported in Appxiom dashboard.
Q: Do I need to modify AndroidManifest.xml for Jetpack Compose tracking?
A: No, Jetpack Compose tracking requires only the standard Appxiom SDK initialization. No special manifest changes are needed.
Q: What should I do if Compose screen events are not being tracked?
A: Ensure you have correctly integrated AxNavigationController and placed AxThisNavBackStackEntry in each screen composable. Check the Appxiom dashboard for event logs and consult the documentation for troubleshooting tips.