简体   繁体   English

Google Analytics(分析)是否可以在Android上使用服务?

[英]Does google analytics work for service on android?

I want to track user's action on service. 我想跟踪用户对服务的操作。 For example,How often they would have started the service,etc. 例如,他们多久启动一次服务等等。

Does Google Analytics provide any API for these? Google Analytics(分析)是否提供任何API?

EasyTracker.getInstance(this).activityStart(this) is only used for Activity? EasyTracker.getInstance(this).activityStart(this)仅用于Activity?

I think you can track this as an event. 我认为您可以将其作为事件进行跟踪。

https://developers.google.com/analytics/devguides/collection/android/v3/events https://developers.google.com/analytics/devguides/collection/android/v3/events

EasyTracker easyTracker = EasyTracker.getInstance(this);

  // MapBuilder.createEvent().build() returns a Map of event fields and values
  // that are set and sent with the hit.
  easyTracker.send(MapBuilder
      .createEvent("ui_action",     // Event category (required)
                   "button_press",  // Event action (required)
                   "play_button",   // Event label
                   null)            // Event value
      .build()
  );

Although, you could send an event when the user performs an action instead, to start the service. 虽然,您可以在用户执行操作时发送事件以启动服务。 That would be more convenient. 那会更方便。

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

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