Google analytics does not collect of statistics in my android app

446 views Asked by At

I want to add statistic in my android application. Read article http://code.google.com/intl/ru/apis/analytics/docs/mobile/android.html#startingTheTracker and done below

1 added library libGoogleAnalytics.jar in my application 2 added in manifest

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

3 changed source code

    private GoogleAnalyticsTracker tracker;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    tracker = GoogleAnalyticsTracker.getInstance();
    // Start the tracker in manual dispatch mode...
    tracker.startNewSession(GOOGLE_ANALYTICS, this);
    tracker.trackPageView("/MainListView");

...

protected void onDestroy() {
    super.onDestroy();
    tracker.stopSession();
}

4 I created "fake" site for application (https://sites.google.com/site/balancetransportcardkazan/ :) )

5 registered site in https://www.google.com/analytics/, constant GOOGLE_ANALYTICS is for this site.

statistic is empty, What I forgot to do?

3

There are 3 answers

0
chubbsondubs On

You have to dispatch the changes to the server. Here is an excerpt from my wrapper class around GoogleTracker to make it easier for me.

public void trackPageView(String page) {
    tracker.trackPageView( packageName + "/" + getVersionCode() + "/" + page );
    tracker.dispatch();
}

public void trackEvent(String action, String label, int count) {
    tracker.trackEvent( packageName, action, label, count );
    tracker.dispatch();
}

public void trackEvent(String action) {
    tracker.trackEvent(packageName, action, null, 0 );
    tracker.dispatch();
}
0
Dipali On

I think for getting statics of your android app, you should implement google analytics code into all your classes/functions of the your app.

I think below link can help you for How to implement Google Analytics for android app -

http://www.tatvic.com/blog/android-application-tracking-through-google-analytics/

0
manjusg On

As mentioned by chubbard You need to dispatch the events to get it tracked. check your logs whether requests are sent to GA server. As i have seen it usually takes around 4-5 hours for statistics to get updated. While viewing the report ensure the report date is current date. By default the report will be shown for yesterday.