• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Simple Analytics Code

Forgivee

Newbie
I am using a simple Google Analytics code. When I look the real-time users on Google Analytics, I can see "1 active user now". There is no problem, but I am suspicious that this code will give wrong results on Google Analytics because When I look their guides, their implementations is different. Can this code give wrong result on Google Analytics? My Code:

Declaration in MainActivity

public static GoogleAnalytics analytics;
public static Tracker tracker;​

Implementation in onCreate

analytics = GoogleAnalytics.getInstance(this);
analytics.setLocalDispatchPeriod(1800);
tracker = analytics.newTracker(unitid);
tracker.enableExceptionReporting(true);
tracker.enableAdvertisingIdCollection(true);
tracker.enableAutoActivityTracking(true);​

No more code, just 6 lines. If there is no problem for this code, why their guide is complex?

Note: There is no problem now, but I am suspicious about future.
 
Back
Top Bottom