简体   繁体   中英

Android/Google Analytics SDK : how to make REAL TIME analytics working?

I installed the Google Analytics SDK in my app.

I want to be able to have real time analytics (new feature proposed by Google).

My code:

tracker = GoogleAnalyticsTracker.getInstance();
// the tracker is started with a dispatch interval of 20 seconds.
tracker.startNewSession("UA-XXXXX", 20, theContext);
tracker.trackEvent("Init", theContext.getPackageName(),"NoLabel", 0);
tracker.dispatch();

I can follow the "Init" event but the real time stats (giving for example the actual number of users using my app) doesn't work, even if I took can to init my tracker with a dispatch time, and not like this:

tracker.startNewSession("UA-XXXX", theContext);

Do you know how to solve this issue ?

Thanks !!

You should use trackPageView if you want it to work with real time Google Analytics. They haven't yet enabled this for events, only for page views, unfortunately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM