如何使用分析服务来指示页面视图
How to use Analytics service to indicate a page view
我正在尝试在显示特定表单时设置页面视图,这是一个 GUI 生成器项目。我在 initVars 方法中使用 Google Analytics ID 和我的应用程序名称初始化了 AnalyticsService,然后当我想触发页面视图时,我使用了 AnalyticsService.visit(页面名称,引用者)。当我查看 Google 分析数据时,总是不显示任何页面信息。
需要做什么才能将页面查看信息发送到 Google Analytics?我是不是调用错了访问方法?
这里是初始化:
public StateMachine(String resFile) {
super(resFile);
// do not modify, write code in initVars and initialize class members
// there,
// the constructor might be invoked too late due to race conditions that
// might occur
}
/**
* this method should be used to initialize variables instead of the
* constructor/class scope to avoid race conditions
*/
protected void initVars(Resources res) {
Display.getInstance().lockOrientation(true);
AnalyticsService.init("(my Analytics ID)",
"rpcontrol.fastlaneinnovations.com");
AnalyticsService.setAppsMode(true);
AnalyticsService.setFailSilently(false):
....bunch more stuff}
然后我尝试在其他地方触发页面视图:
@Override
protected void beforeDataLogs(Form f) {
logsContainer = findLogsContainer(f);
updateLogList();
AnalyticsService.visit("Logs", "");
}
AnalyticsService
class 似乎有两种模式,如果您创建了移动应用分析,则需要启用应用模式使用
setAppsMode.
这可能比使用旧移动网站方法的默认行为要好,不幸的是,我认为我们不能改变默认设置,因为这会破坏可能依赖此 API 的现有应用程序。
我正在尝试在显示特定表单时设置页面视图,这是一个 GUI 生成器项目。我在 initVars 方法中使用 Google Analytics ID 和我的应用程序名称初始化了 AnalyticsService,然后当我想触发页面视图时,我使用了 AnalyticsService.visit(页面名称,引用者)。当我查看 Google 分析数据时,总是不显示任何页面信息。
需要做什么才能将页面查看信息发送到 Google Analytics?我是不是调用错了访问方法?
这里是初始化:
public StateMachine(String resFile) {
super(resFile);
// do not modify, write code in initVars and initialize class members
// there,
// the constructor might be invoked too late due to race conditions that
// might occur
}
/**
* this method should be used to initialize variables instead of the
* constructor/class scope to avoid race conditions
*/
protected void initVars(Resources res) {
Display.getInstance().lockOrientation(true);
AnalyticsService.init("(my Analytics ID)",
"rpcontrol.fastlaneinnovations.com");
AnalyticsService.setAppsMode(true);
AnalyticsService.setFailSilently(false):
....bunch more stuff}
然后我尝试在其他地方触发页面视图:
@Override
protected void beforeDataLogs(Form f) {
logsContainer = findLogsContainer(f);
updateLogList();
AnalyticsService.visit("Logs", "");
}
AnalyticsService
class 似乎有两种模式,如果您创建了移动应用分析,则需要启用应用模式使用
setAppsMode.
这可能比使用旧移动网站方法的默认行为要好,不幸的是,我认为我们不能改变默认设置,因为这会破坏可能依赖此 API 的现有应用程序。