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);
        analytics.getLogger().setLogLevel(Logger.LogLevel.ERROR);
        tracker = analytics.newTracker("XX-XXXXXX-XX");
        tracker.setAnonymizeIp(true);
        tracker.enableAutoActivityTracking(false); // tracking manually
        tracker.enableExceptionReporting(true);
    }
}

      

and then

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

      

Do you see any problems with this implication?

+3
android google-analytics


source to share


No one has answered this question yet

Check out similar questions:

890
How to check if a service is running on Android?
586
How to start a new activity on button click
247
Can you test Google Analytics at localhost?
214
How to remove a property from Google Analytics
13
Why is my exception handler not catching SQLite SQLite insert error?
3
Google Analytics iOS SDK "1 sec. Sessions" (maybe background sessions?)
1
The Google Analytics SDK for iOS doesn't track screens or events anymore. used for work
1
Google Analytics for android ignores setDebug
0
how to use GANTracker for long running iOS apps including background audio
0
Increasing the Universal Analytics session



All Articles
Loading...
X
Show
Funny
Dev
Pics