I'm using EasyTracker from the SDK for Android V2.0 beta 3. I've followed all the steps described at https://developers.google.com/analytics/devguides/collection/android/v2/, and have ensured that there are hyphen characters and not en dashes in my ga_trackingId parameter value.
I've tried my app in emulators for both Android 2.2 and 4.1.2, as well as on a real device. Here is (partially redacted) output from LogCat:
11-17 20:13:50.587: W/GAV2(542): Thread[main,5,main]: Connection to service failed 1
11-17 20:13:50.616: W/GAV2(542): Thread[main,5,main]: Need to call initialize() and be in fallback mode to start dispatch.
11-17 20:13:50.616: I/GAV2(542): Thread[main,5,main]: ExceptionReporter created, original handler is com.android.internal.os.RuntimeInit$UncaughtHandler
11-17 20:13:52.617: I/GAV2(542): Thread[GAThread,5,main]: No campaign data found.
11-17 20:13:52.646: I/GAV2(542): Thread[GAThread,5,main]: putHit called
11-17 20:13:55.606: I/GAV2(542): Thread[Service Reconnect,5,main]: connecting to Analytics service
11-17 20:13:55.616: I/GAV2(542): Thread[Service Reconnect,5,main]: connect: bindService returned false for Intent { act=com.google.android.gms.analytics.service.START (has extras) }
11-17 20:13:55.616: W/GAV2(542): Thread[Service Reconnect,5,main]: Connection to service failed 1
11-17 20:13:55.616: I/GAV2(542): Thread[Service Reconnect,5,main]: falling back to local store
11-17 20:13:55.635: I/GAV2(542): Thread[GAThread,5,main]: Sending hit to store
11-17 20:13:55.666: I/GAV2(542): Thread[GAThread,5,main]: PowerSaveMode initiated.
11-17 20:13:55.696: I/GAV2(542): Thread[GAThread,5,main]: PowerSaveMode terminated.
11-17 20:13:55.696: V/GAV2(542): Thread[GAThread,5,main]: dispatch running...
11-17 20:13:55.746: I/GAV2(542): Thread[GAThread,5,main]: User-Agent: GoogleAnalytics/2.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91)
11-17 20:13:55.746: I/GAV2(542): Host: www.google-analytics.com
11-17 20:13:55.746: I/GAV2(542): GET /collect?ul=en-us&sr=480x800&a=935594353&sc=start&aid=com.xxx.android&cid=2b8c0c5de52ba05e&av=1.0&v=1&t=appview&an=xxx&tid=UA-xxx-55&_u=.nUWlMB&_v=ma1b3&cd=com.xxx.android.MainActivity&qt=5123&z=184 HTTP/1.1
11-17 20:13:56.116: V/GAV2(542): Thread[GAThread,5,main]: sent 1 of 1 hits
11-17 20:13:56.126: I/GAV2(542): Thread[GAThread,5,main]: PowerSaveMode initiated.
...
11-17 20:15:09.206: V/GAV2(542): Thread[GAThread,5,main]: dispatch running...
11-17 20:15:09.206: V/GAV2(542): Thread[GAThread,5,main]: ...nothing to dispatch
11-17 20:15:09.256: I/GAV2(542): Thread[GAThread,5,main]: putHit called
11-17 20:15:09.256: I/GAV2(542): Thread[GAThread,5,main]: Sending hit to store
11-17 20:15:09.316: I/GAV2(542): Thread[GAThread,5,main]: PowerSaveMode terminated.
11-17 20:15:11.706: V/GAV2(542): Thread[GAThread,5,main]: dispatch running...
11-17 20:15:11.716: I/GAV2(542): Thread[GAThread,5,main]: User-Agent: GoogleAnalytics/2.0 (Linux; U; Android 2.2; en-us; sdk Build/FRF91)
11-17 20:15:11.716: I/GAV2(542): Host: www.google-analytics.com
11-17 20:15:11.716: I/GAV2(542): GET /collect?v=1&ul=en-us&t=appview&sr=480x800&an=xxx&a=448166238&tid=UA-xxx-55&aid=com.xxx.android&cid=2b8c0c5de52ba05e&_u=.sB&av=1.0&_v=ma1b3&cd=com.xxx.android.ProductActivity&qt=2500&z=185 HTTP/1.1
11-17 20:15:11.986: V/GAV2(542): Thread[GAThread,5,main]: sent 1 of 1 hits
11-17 20:15:12.006: I/GAV2(542): Thread[GAThread,5,main]: PowerSaveMode initiated.
I've gone through all the relevant posts on SO.
According to this: http://blog.blundell-apps.com/google-analytics-common-problems-and-fixes/, the fact that I'm seeing "...nothing to dispatch" indicates that the data was sent.
I'm not concerned about the "Connection to service failed 1" warning, as it hasn't stopped analytics data being recorded for other people ( stackoverflow.com/questions/13222468/android-google-analytics-connection-to-service-failed ).
Here's my analytics.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="https://schemas.android.com/tools" tools:ignore="TypographyDashes">
<string name="ga_trackingId">UA-xxx-55</string>
<bool name="ga_autoActivityTracking">true</bool>
<bool name="ga_reportUncaughtExceptions">true</bool>
<integer name="ga_dispatchPeriod">2</integer>
<bool name="ga_debug">true</bool>
</resources>
And part of my base activity:
public class BaseActivity extends ActionBarActivity {
@Override
public void onStart() {
super.onStart();
EasyTracker.getInstance().activityStart(this);
}
@Override
public void onStop() {
super.onStop();
EasyTracker.getInstance().activityStop(this);
}
}
The question is, why is my data still not showing up in Google Analytics? I've waited the requisite 24-48 hours, and it's still empty.
A trouble-shooting related question is: if I call this URL directly from the browser or from Fiddler: http:// www.google-analytics.com/collect?v=1&ul=en-us&t=appview&sr=480x800&an=xxx&a=1825278197&tid=UA-xxx-55&aid=com.xxx.android&cid=2b8c0c5de52ba05e&_u=.sB&av=1.0&_v=ma1b3&cd=com.xxx.android.ProductActivity&qt=2414&z=141, should the hit be recorded? (The response is a 1x1 gif image.) If so, then that may help to isolate the problem to setup of the analytics account, somehow. (I'm using this account for many other websites and web tracking is working fine.)
Edit: Should LogCat for this version show "HTTP Response Code: 200", as this post and the Blundell one linked to above allude to, albeit for what seems an earlier version of EasyTracker: www.asgarddesigns.com.au/2012/05/easytracker-google-analytics-integration-for-android/? Mine doesn't, but I suspect it may be because this log message was removed from the latest version.
With version 2.0 of the Google Analytics SDK for Android and iOS, you need to create a NEW profile in GA using the App type to be able to see data being collected and reported.
This is not really highlighted but you'll find it described in the migration guide for example.
It means that it will break the history of your data from the 1.x version, but data collection and reports are too different to be mixed together, at least while they are in beta stage.