我需要使用Android
Google Analytics
应用
到目前为止,我可以跟踪Activities
EasyTracker.getInstance(this).activityStart(this);
但我想传递自定义字符串而不是活动本身,例如.setString("My activity")
有没有办法做到这一点?
提前致谢
答案 0 :(得分:1)
您可以按如下所述发送屏幕:
Tracker easyTracker = EasyTracker.getInstance(this);
// This screen name value will remain set on the tracker and sent with
// hits until it is set to a new value or to null.
easyTracker.set(Fields.SCREEN_NAME, "My Activity");
easyTracker.send(MapBuilder
.createAppView()
.build()
);
答案 1 :(得分:0)
在值中创建analytics.xml文件。
并设置屏幕名称的活动...
<强> analytics.xml 强>
<resources>
<!-- Replace placeholder ID with your tracking ID -->
<string name="ga_trackingId">UA-47448579-1</string>
<!-- Enable automatic activity tracking -->
<bool name="ga_autoActivityTracking">true</bool>
<integer name="ga_dispatchPeriod">2</integer>
<!-- Enable automatic exception tracking -->
<bool name="ga_reportUncaughtExceptions">true</bool>
<!-- The screen names that will appear in reports -->
<string name="com.AnimalApp.LauncherActivity">Launcher Screen</string>
<string name="com.AnimalApp.AnimalActivity">Animal Screen</string>
<string name="com.AnimalApp.QuizActivity">Quiz Screen</string>