Android:Google Play 服务中的 Google Analytics 可用性? [英] Android: Google Analytics availability in Google Play Services?

查看:20
本文介绍了Android:Google Play 服务中的 Google Analytics 可用性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Analytics 已宣布成为推出的 Google Play 服务 4.3 的一部分,但它尚未包含在 Google Play 服务包列表中:

Google Analytics has been announced to become part of the rolling out Google Play Services 4.3, however it is not yet included in the Google Play Services packages list:

http://developer.android.com/reference/gms-packages.html

知道它什么时候可用,立即使用是否安全,还是等待一段时间以确保每个用户都已经安装了 Google Play Services 4.3 会更好?

Any idea when it will become available, and will it be safe to be used straight away, or will it be better to wait for some time to make sure every user has Google Play Services 4.3 already installed?

推荐答案

我注意到了其他一些差异.

I've noticed some other differences.

跟踪器

要获得新的 Tracker,请使用 newTracker() 方法(接受 String 值和 int值[用于XML配置]):

To get a new Tracker, use the newTracker() method (accepts both a String value and an int value [for XML configuration]):

googleTracker = gaInstance.getTracker(GA_KEY); // OLD
googleTracker = gaInstance.newTracker(GA_KEY); // NEW

EasyTracker

EasyTracker 现在已经消失了,所以我们将不得不使用 GoogleAnalytics.getInstance(this).reportActivityStart(this),正如 Paito 所报告的那样.

EasyTracker has now disappeared, so we will have to use GoogleAnalytics.getInstance(this).reportActivityStart(this) as reported by Paito.

二传手

googleTracker.set() 方法不再可用.它已被更专业的方法所取代,例如:

The googleTracker.set() method is no longer available. It has been replaced with more specialised methods, for example:

googleTracker.set(Fields.SCREEN_NAME, null); // OLD
googleTracker.setScreenName(null);           // NEW

活动创建

googleTracker.send() 方法也发生了一些变化.

The googleTracker.send() method has also seen some changes.

googleTracker.send(MapBuilder
                .createEvent(category, action, label, value)
                .build()); // OLD
googleTracker.send(new HitBuilders.EventBuilder()
                .setCategory(category)
                .setAction(action)
                .setLabel(label)
                .setValue(value)
                .build()); // NEW

AppView

现在变成了

googleTracker.send(MapBuilder.createAppView().build());       // OLD
googleTracker.send(new HitBuilders.AppViewBuilder().build()); // NEW

AppViewBuilder

AppViewBuilder 现在已被弃用,取而代之的是新的 ScreenViewBuilder 类.(感谢海防的提示!)

AppViewBuilder has now been deprecated, replaced by the new ScreenViewBuilder class. (thanks Hai Phong for the tip!)

对于那些遇到(或已经处理)Dalvik 的 64K 方法限制的人,现在您可以在应用程序中摆脱 3K 方法,多亏了这一点整合.

For those who are running into (or have already dealt with) the Dalvik's 64K methods limit, there are now 3K methods that you will be able to get rid of in your application, thanks to this integration.

这篇关于Android:Google Play 服务中的 Google Analytics 可用性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆