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:
谷歌Analytics已宣布成为推出谷歌Play服务4.3的一部分,但尚未包含在谷歌Play服务包列表中:
http://developer.android.com/reference/gms-packages.html
http://developer.android.com/reference/gms-packages.html
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?
你知道它什么时候可以使用吗?它是安全的,可以直接使用,还是等一段时间来确保每个用户都已经安装了谷歌游戏服务?
4 个解决方案
#1
37
I've noticed some other differences.
我还注意到了一些其他的差异。
Tracker
跟踪器
To get a new Tracker
, use the newTracker()
method (accepts both a String
value and an int
value [for XML configuration]):
要获得新的跟踪器,请使用newTracker()方法(接受字符串值和int值[用于XML配置]):
googleTracker = gaInstance.getTracker(GA_KEY); // OLD
googleTracker = gaInstance.newTracker(GA_KEY); // NEW
EasyTracker
EasyTracker
EasyTracker has now disappeared, so we will have to use GoogleAnalytics.getInstance(this).reportActivityStart(this)
as reported by Paito.
EasyTracker现在已经消失了,所以我们将不得不使用GoogleAnalytics.getInstance(这个). reportactivitystart(这个)。
Setters
setter
The googleTracker.set()
method is no longer available. It has been replaced with more specialised methods, for example:
googleTracker.set()方法不再可用。取而代之的是更专业的方法,例如:
googleTracker.set(Fields.SCREEN_NAME, null); // OLD
googleTracker.setScreenName(null); // NEW
Event creation
事件创建
The googleTracker.send()
method has also seen some changes.
send()方法也看到了一些变化。
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
AppView
It now becomes
现在变成了
googleTracker.send(MapBuilder.createAppView().build()); // OLD
googleTracker.send(new HitBuilders.AppViewBuilder().build()); // NEW
AppViewBuilder
AppViewBuilder
AppViewBuilder
has now been deprecated, replaced by the new ScreenViewBuilder
class. (thanks Hai Phong for the tip!)
AppViewBuilder现在已被弃用,取而代之的是新的ScreenViewBuilder类。(感谢海防的建议!)
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.
对于那些遇到(或已经处理过)Dalvik的64K方法限制的人来说,现在有3K方法可以在应用程序中删除,这多亏了这个集成。
#2
3
It's part of the package list now.
它现在是包列表的一部分。
I think the basic functionality works something like this...
我认为基本的功能是这样的……
import com.google.android.gms.analytics.GoogleAnalytics;
@Override
protected void onStart() {
super.onStart();
GoogleAnalytics.getInstance(this).reportActivityStart(this);
}
@Override
protected void onStop() {
super.onStop();
GoogleAnalytics.getInstance(this).reportActivityStop(this);
}
#3
1
As per conversation in order to use Easytracker replacement with
按照会话来使用Easytracker替换为
GoogleAnalytics.getInstance(this).reportActivityStart(this);
GoogleAnalytics.getInstance(this).reportActivityStop(this);
You need to add your config to AndroidManifest like
您需要将配置添加到AndroidManifest中
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/analytics_global_config" />
I'm still having to get instance of Tracker to send Events, may be somebody else would have better luck at replacing
我还得找个追踪器的实例来发送事件,也许其他人会有更好的运气来代替
EasyTracker.getInstance(mContext).send(MapBuilder....)
#4
0
The documentation for Google Analytics SDK v4 (now part of Google Play Services) has just been published!
谷歌分析SDK v4(现在是谷歌Play服务的一部分)的文档刚刚发布!
https://developers.google.com/analytics/devguides/collection/android/v4/
https://developers.google.com/analytics/devguides/collection/android/v4/
#1
37
I've noticed some other differences.
我还注意到了一些其他的差异。
Tracker
跟踪器
To get a new Tracker
, use the newTracker()
method (accepts both a String
value and an int
value [for XML configuration]):
要获得新的跟踪器,请使用newTracker()方法(接受字符串值和int值[用于XML配置]):
googleTracker = gaInstance.getTracker(GA_KEY); // OLD
googleTracker = gaInstance.newTracker(GA_KEY); // NEW
EasyTracker
EasyTracker
EasyTracker has now disappeared, so we will have to use GoogleAnalytics.getInstance(this).reportActivityStart(this)
as reported by Paito.
EasyTracker现在已经消失了,所以我们将不得不使用GoogleAnalytics.getInstance(这个). reportactivitystart(这个)。
Setters
setter
The googleTracker.set()
method is no longer available. It has been replaced with more specialised methods, for example:
googleTracker.set()方法不再可用。取而代之的是更专业的方法,例如:
googleTracker.set(Fields.SCREEN_NAME, null); // OLD
googleTracker.setScreenName(null); // NEW
Event creation
事件创建
The googleTracker.send()
method has also seen some changes.
send()方法也看到了一些变化。
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
AppView
It now becomes
现在变成了
googleTracker.send(MapBuilder.createAppView().build()); // OLD
googleTracker.send(new HitBuilders.AppViewBuilder().build()); // NEW
AppViewBuilder
AppViewBuilder
AppViewBuilder
has now been deprecated, replaced by the new ScreenViewBuilder
class. (thanks Hai Phong for the tip!)
AppViewBuilder现在已被弃用,取而代之的是新的ScreenViewBuilder类。(感谢海防的建议!)
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.
对于那些遇到(或已经处理过)Dalvik的64K方法限制的人来说,现在有3K方法可以在应用程序中删除,这多亏了这个集成。
#2
3
It's part of the package list now.
它现在是包列表的一部分。
I think the basic functionality works something like this...
我认为基本的功能是这样的……
import com.google.android.gms.analytics.GoogleAnalytics;
@Override
protected void onStart() {
super.onStart();
GoogleAnalytics.getInstance(this).reportActivityStart(this);
}
@Override
protected void onStop() {
super.onStop();
GoogleAnalytics.getInstance(this).reportActivityStop(this);
}
#3
1
As per conversation in order to use Easytracker replacement with
按照会话来使用Easytracker替换为
GoogleAnalytics.getInstance(this).reportActivityStart(this);
GoogleAnalytics.getInstance(this).reportActivityStop(this);
You need to add your config to AndroidManifest like
您需要将配置添加到AndroidManifest中
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/analytics_global_config" />
I'm still having to get instance of Tracker to send Events, may be somebody else would have better luck at replacing
我还得找个追踪器的实例来发送事件,也许其他人会有更好的运气来代替
EasyTracker.getInstance(mContext).send(MapBuilder....)
#4
0
The documentation for Google Analytics SDK v4 (now part of Google Play Services) has just been published!
谷歌分析SDK v4(现在是谷歌Play服务的一部分)的文档刚刚发布!
https://developers.google.com/analytics/devguides/collection/android/v4/
https://developers.google.com/analytics/devguides/collection/android/v4/