I have an application with a reused activity (its used for different purposes so just tracking the activity name would not help me, thats why I want to define the screen name manually while still using the EasyTracker. My code looks like this:
EasyTracker t = EasyTracker.getInstance(this);
t.set(Fields.SCREEN_NAME, screenName);
// MapBuilder map = MapBuilder.createAppView();
// map.set(Fields.SCREEN_NAME, screenName);
// t.send(map.build());
t.activityStart(this);
I got these information from https://developers.google.com/analytics/devguides/collection/android/v3/screens
I dont want to do this without the EasyTracker because I didn't find any information what exactly happens in the methods activityStart() and activityStop() of the easy tracker so I cant reproduce this behaviour with a custom tracker and I think the inforation which is collected in the activityStart() method in addition to the screen name is also very usefull. So has someone experience with defining custom values in the easy tracker? Is it a good way to do it this way or is there a better solution?
If anyone comes across the question, the as per the v3 of the Google Analytics SDK,
EasyTracker.getInstance(this).activityStart(SCREEN_NAME); // Add this method.
where SCREEN_NAME is the user defined constant for the reused Activity.
Using custome screen names instead of the default ones i.e the full qualified path name of the Activity doesn't cause any issues in data collection.
Recommendation, Use Google Tag Manager for your Tracking purpose, it provide you better flexibility like changing the UA property ID in future as well the screen names to be sent to Google Analytics. Read more @ Developer Guide For Android
来源:https://stackoverflow.com/questions/18358829/google-analytics-custom-screen-names-in-easy-tracker