简体   繁体   中英

Analytics v2 for android

I'm using the Google analytics sdk for android v2

When I use the parameter trackEvent tracker.trackEvent (category, action, label, value)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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