I'm having problems tracking my app with Google Analytics. In all the activities that I need to track (2 for now, more in the future) I have the same code for GA handling:
@Override
public void onStop() {
super.onStop();
EasyTracker easyTracker = EasyTracker.getInstance(this);
easyTracker.activityStop(this);
}
@Override
protected void onStart() {
super.onStart();
EasyTracker easyTracker = EasyTracker.getInstance(this);
easyTracker.activityStart(this);
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
if (uncaughtExceptionHandler instanceof ExceptionReporter) {
ExceptionReporter exceptionReporter = (ExceptionReporter) uncaughtExceptionHandler;
exceptionReporter.setExceptionParser(new AnalyticsExceptionParser());
}
}
@Override
public void onResume() {
Tracker easyTracker = EasyTracker.getInstance(this);
easyTracker.set(Fields.SCREEN_NAME, SCREEN_LABEL);
easyTracker.send(
MapBuilder
.createAppView()
.build());
super.onResume();
}
And here's the analytics.xml file:
<resources xmlns:tools="https://schemas.android.com/tools" tools:ignore="TypographyDashes">
<!-- Replace placeholder ID with your tracking ID -->
<string name="ga_trackingId">UA-XXXXXXX-Y</string>
<!-- Enable automatic activity tracking -->
<bool name="ga_autoActivityTracking">true</bool>
<!-- Enable automatic exception tracking -->
<bool name="ga_reportUncaughtExceptions">true</bool>
<integer name="ga_dispatchPeriod">10</integer>
</resources>
The problem is that at the first visualization of the activity the screen name results to be correct (Home Screen for one activity and Login Screen for the other). But at the second visualization the screen name changes to the Qualified Name of the activity (it.prova.HomePage for one activity and it.prova.LoginPanel for the other one).
Where am I wrong?
THX
P.S. obviously, where I write UA-XXXXXXX-Y I have the correct string, not this example one.
Found the problem: I had to change this
<bool name="ga_autoActivityTracking">true</bool>
into this
<bool name="ga_autoActivityTracking">false</bool>
So now i have complete control of the tracking in my code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With