gpt4 book ai didi

azure-application-insights - DOXFX 使用 Application Insights 最终用户用户分析

转载 作者:行者123 更新时间:2023-12-05 04:10:26 29 4
gpt4 key购买 nike

如何将 Application insights 最终用户用户分析添加到 DocFx 以跟踪每个文档页面的使用情况?

Application Insights 文档指出您需要在结束标记之前立即插入下面列出的 JavaScript 片段,但我不确定这在 DocFx 中是否可行或是否是完成此操作的最佳方式。

您需要后处理器,还是可以使用自定义模板?

<!-- 
To collect end-user usage analytics about your application,
insert the following script into each page you want to track.
Place this code immediately before the closing </head> tag,
and before any other scripts. Your first data will appear
automatically in just a few seconds.
-->
<script type="text/javascript">
var appInsights=window.appInsights||function(config){
function i(config){t[config]=function(){var
i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
}({
instrumentationKey:"###-###-###-##"
});

window.appInsights=appInsights;
appInsights.trackPageView();
</script>

最佳答案

不需要后处理器。您可以通过自定义模板来实现这一点。更多信息可以在 official tutorial 中找到或 this question .您可以在 partials/head.tmpl.partial 中添加您的代码。它会影响所有生成的页面。

关于azure-application-insights - DOXFX 使用 Application Insights 最终用户用户分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44471300/

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