maratische
maratische

Reputation: 41

Google analytics does not collect of statistics in my android app

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?

Upvotes: 0

Views: 447

Answers (3)

manjusg
manjusg

Reputation: 2263

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.

Upvotes: 2

Dipali
Dipali

Reputation: 1

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/

Upvotes: 0

chubbsondubs
chubbsondubs

Reputation: 38842

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();
}

Upvotes: 2

Related Questions