16

我正在使用 SDK for Android V2.0 beta 3 中的 EasyTracker。我已遵循https://developers.google.com/analytics/devguides/collection/android/v2/中描述的所有步骤,并确保我的 ga_trackingId 参数值中有连字符而不是破折号。

我已经在 Android 2.2 和 4.1.2 的模拟器以及真实设备上尝试了我的应用程序。这是来自 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.

我已经浏览了所有关于 SO 的相关帖子。

据此:http ://blog.blundell-apps.com/google-analytics-common-problems-and-fixes/ ,我看到“......没有发送”的事实表明数据已发送.

我不担心“连接到服务失败 1”警告,因为它没有停止为其他人记录分析数据(stackoverflow.com/questions/13222468/android-google-analytics-connection-to-service-失败的 )。

这是我的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>

我的基础活动的一部分:

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

问题是,为什么我的数据仍然没有显示在 Google Analytics 中?我已经等了必要的 24-48 小时,但它仍然是空的。

与故障排除相关的问题是:如果我直接从浏览器或 Fiddler 调用此 URL: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,是否应该记录命中?(响应是 1x1 gif 图像。)如果是这样,那么这可能有助于以某种方式将问题隔离到分析帐户的设置。(我将此帐户用于许多其他网站,并且网络跟踪工作正常。)

编辑:此版本的 LogCat 是否应该显示“HTTP 响应代码:200”,因为这篇文章和上面链接的 Blundell 文章都提到了,尽管似乎是 EasyTracker 的早期版本:www.asgarddesigns.com.au/2012/05 /easytracker-google-analytics-integration-for-android/? 我的没有,但我怀疑可能是因为此日志消息已从最新版本中删除。

4

1 回答 1

13

使用适用于 Android 和 iOS 的 Google Analytics SDK 2.0 版,您需要使用App 类型在 GA 中创建一个新的配置文件,以便能够查看正在收集和报告的数据。

这并没有真正突出显示,但您会在迁移指南中找到它的描述。

这意味着它将打破 1.x 版本的数据历史记录,但数据收集和报告差异太大,无法混合在一起,至少在它们处于 beta 阶段时是这样。

于 2012-11-19T09:05:53.183 回答