0
我們如何使用Google Analytics(分析)v4跟蹤片段?Android:使用谷歌分析v4跟蹤片段?
這裏是我的應用程序類:
public class MyApplication extends Application {
private static final String PROPERTY_ID = "UA-XXXXXXX-1";
public static int GENERAL_TRACKER = 0;
public enum TrackerName {
APP_TRACKER
}
HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
public MyApplication() {
super();
}
synchronized Tracker getTracker(TrackerName trackerId) {
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
Tracker t = analytics.newTracker(R.xml.app_tracker);
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}
}