I am tracking android app activity screens under custom label. However, in the GA dashboard, activities are shown with their default path along with custom labels. Also the metric numbers being tracked under two labels of the same activity are different.
Attached is a screen shot for better illustration:
Here the
MainActivity
and Home screen
are referring the same activity. But GA shows two separate labels. How can I get rid of one MainActivity
label?
Asked
Active
Viewed 990 times
0

user1036908
- 831
- 1
- 12
- 16
2 Answers
1
You probably have enabled automatic screen tracking. Turn it off and it should disappear.
See here for the description of the property if you use xml or here if you initialize it programmatically.

David Medenjak
- 33,993
- 14
- 106
- 134
0
You can turn off automatic screen tracking by using enableAutoActivityTracking(false)
in code:
Or via the XML file:
<bool name="ga_autoActivityTracking">false</bool>
https://developers.google.com/analytics/devguides/collection/android/v4/screens#automatic
Tracking things manually can be done using these:
fun trackScreen(context: Context, screenObject: Any, screenName: String? = null) {
if (screenName == null)
trackScreen(context, screenObject.javaClass)
else
trackScreen(context, screenObject.javaClass, screenName)
}
fun trackScreen(context: Context, clazz: Class<Any>, screenName: String = clazz.simpleName) {
if (BuildConfig.DEBUG)
return
val className = clazz.canonicalName ?: clazz.name
FirebaseAnalytics.getInstance(context).logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {
param(FirebaseAnalytics.Param.SCREEN_NAME, screenName)
param(FirebaseAnalytics.Param.SCREEN_CLASS, className)
}
}
So you can use registerActivityLifecycleCallbacks
and use the above function, for example:

android developer
- 114,585
- 152
- 739
- 1,270