如何使用Google Analytics
跟踪Android上的浮动视图。我在谈论使用WindowManager
添加到窗口的视图
并且需要SYSTEM_ALERT_WINDOW
许可。
Activity
和EasyTracker
activityStart
可以跟踪 activityStop
这些方法将Activity
作为参数
View
有什么想法吗?
答案 0 :(得分:0)
在res / values /下调用analytics.xml
以这种方式组织:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<!--Replace placeholder ID with your tracking ID-->
<string name="ga_trackingId">UA-xxxxxxx-x</string>
<!--Enable automatic activity tracking-->
<bool name="ga_autoActivityTracking">true</bool>
<!--Enable automatic exception tracking-->
<bool name="ga_reportUncaughtExceptions">true</bool>
<string name="com.example.project.Class">Main Activity</string>
<string name="com.example.project.Class2">Activity 2</string>
</resources>
在每个课堂/活动中,在关闭最后一个括号之前放置它:
//Tracker method starts..
@Override
public void onStart() {
super.onStart();
// The rest of your onStart() code.
EasyTracker.getInstance(this).activityStart(this); // Add this method.
}
@Override
public void onStop() {
super.onStop();
// The rest of your onStop() code.
EasyTracker.getInstance(this).activityStop(this); // Add this method.
}
//Tracker method ends..
注意:将自动添加导入的导入。但在执行此操作之前,请确保已将Google服务和库与您的项目结算。