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

时间:2017-08-18 17:28:13

标签: javascript azure azure-application-insights

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

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

意味着......我们可以添加更多参数来跟踪其他内容。就像我想跟踪用户在网页上的时长一样,我该如何跟踪?

2 个答案:

答案 0 :(得分:1)

您必须使用Custom Metrics

使用SO thread&进行指标计算将其传递给Application Insights。

appInsights.trackMetric("userstaytime", 42.0);

答案 1 :(得分:0)

此功能内置在JavaScript SDK中。

通过设置<script> var x = 0 if (x >= 50) { // document.getElementById('color').color = #00ff00 // // Note that the getElementById has a .color extension, which is nonexistent. // } else { // document.getElementById('color').color = #ff0000 // </script> <button>Run</button> <input type="text" id='color' value='0'></input> <!-- The input is not disabled for value debugging. --> ,可以跟踪用户在每个页面上花费的时间。在每个新的PageView上,用户在上一页上花费的时间将作为名为autoTrackPageVisitTime: true的自定义指标发送。在Metrics Explorer中,该自定义指标可以作为“基于日志的指标”查看。

您可以找到here的文档。

在创建应用程序见解实例时,您在配置对象中传递PageVisitTime首选项。

autoTrackPageVisitTime