简体   繁体   English

适用于Android的Analytics v2

[英]Analytics v2 for android

I'm using the Google analytics sdk for android v2 我正在使用适用于Android v2的Google Analytics(分析)SDK

When I use the parameter trackEvent tracker.trackEvent (category, action, label, value) 当我使用参数trackEvent tracker.trackEvent(类别,操作,标签,值)时

It indicates that it is deprecated, however I can not find in the documentation which is the new way to use this parameter .. 它表明它已被弃用,但是我在文档中找不到这是使用此参数的新方法。

I am using it to track events, such as the click of a button 我正在使用它来跟踪事件,例如单击按钮

is really deprecated? 真的过时了吗?

Thanks and regards 谢谢并恭祝安康

It appears it has been deprecated. 看来它已被弃用。

According to this you have to use the sendEvent method. 根据此,您必须使用sendEvent方法。

private Tracker myTracker;
private GoogleAnalytics myInstance;
@Override
public void onClick(View v) {
myInstance = GoogleAnalytics.getInstance(this);
myTracker = myInstance.getTracker("UA-XXXX-Y");
// Where myTracker is an instance of Tracker.
myTracker.sendEvent("ui_action", "button_press", "play_button", opt_value);
... // Your other click handling code.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM