Google Analytics: How to check if a new session has started

I changed my tracker from EasyTracker to v4 GoogleAnalytics without changing the xml configuration, as a result I got a huge increase in the number of sessions when I clicked a new release on in the store, resulting in a sharp drop in average reports. Any hint?

No analytic report How do I know when a new session has started?

I am not using the Application class to initialize the tracker object, I made the tracker a single object, initialized it when it is null, otherwise not. Every time I am about to dispatch an event / action, I call initializeTracker (ctx) and then I track the view or action.

public static void initializeTracker(Context context) {
    if (tracker == null) {
        analytics = GoogleAnalytics.getInstance(context);
        tracker = analytics.newTracker("XX-XXXXXX-XX");
        tracker.enableAutoActivityTracking(false); // tracking manually


and then

public static void trackView(Context context, String viewName) {
    tracker.send(new HitBuilders.ScreenViewBuilder().build());


Do you see any problems with this implication?


source to share

All Articles