gpt4 book ai didi

javascript - Azure Application Insights 用于跟踪用户在网页上花费的时间

转载 作者:行者123 更新时间:2023-11-30 21:15:06 28 4
gpt4 key购买 nike

如何使用 Azure Application Insights 跟踪用户在网页上花费的时间。在网页的 javascript 中,有一段来自应用程序洞察的代码,我们必须复制它们。我想了解什么

 r=["Event","Exception","Metric","PageView","Trace","Dependency"]

意味着...我们可以添加更多参数来跟踪其他一些东西。就像如果我想跟踪用户在网页上停留的时间,我该如何跟踪?

最佳答案

此功能内置于 JavaScript SDK 中。

By setting autoTrackPageVisitTime: true, the time a user spends on each page is tracked. On each new PageView, the duration the user spent on the previous page is sent as a custom metric named PageVisitTime. This custom metric is viewable in the Metrics Explorer as a "log-based metric".

您可以找到它的文档 here .

创建应用程序洞察实例时,您可以在配置对象中传递 autoTrackPageVisitTime 首选项。

const appInsights = new ApplicationInsights({ config: {
connectionString: 'YOUR_CONNECTION_STRING_GOES_HERE',
autoTrackPageVisitTime: true,
/* ...Other Configuration Options... */
} });

关于javascript - Azure Application Insights 用于跟踪用户在网页上花费的时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45761999/

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