Skip to main content

Screen Tracking

Track which screens your contacts visit to understand navigation patterns and build segments based on in-app behavior.


Automatic tracking​

Pass true to trackAllActivities() in the builder to track all Activity and Fragment lifecycle events automatically:

UserCom.Builder(this, sdkKey, apiKey, domain)
.trackAllActivities(true)
.build()

Records activity created, started, and stopped events, plus the equivalent fragment lifecycle events.


Manual tracking​

To track specific screens - including Jetpack Compose screens - call trackScreen() with a name:

UserCom.getInstance().trackScreen("Home")

For FragmentActivity or Fragment, you can pass this and the SDK will use the class name as the screen name and also track lifecycle events:

class MainActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
UserCom.getInstance().trackScreen(this)
}
}