gpt4 book ai didi

java - 如何使用 Analytics 服务来指示页面浏览量

转载 作者:行者123 更新时间:2023-11-30 07:39:24 24 4
gpt4 key购买 nike

我试图在显示某种表单时设置页面 View ,这是一个 GUI 构建器项目。我在 initVars 方法中使用 Google Analytics ID 和我的应用程序名称初始化了 AnalyticsService,然后当我想要触发页面 View 时,我使用了 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}

然后在其他地方我尝试触发页面 View :

@Override
protected void beforeDataLogs(Form f) {
logsContainer = findLogsContainer(f);
updateLogList();
AnalyticsService.visit("Logs", "");
}

最佳答案

AnalyticsService 类似乎有两种模式,如果您创建了移动应用程序分析,则需要使用以下命令启用应用程序模式 setAppsMode .

这可能比使用旧移动网站方法的默认行为更好,不幸的是,我认为我们无法翻转默认设置,因为这会破坏可能依赖此 API 的现有应用程序。

关于java - 如何使用 Analytics 服务来指示页面浏览量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34904083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com