首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用应用程序洞察最终用户分析的DOXFX

使用应用程序洞察最终用户分析的DOXFX
EN

Stack Overflow用户
提问于 2017-06-10 16:38:42
回答 1查看 310关注 0票数 2

如何将应用程序洞察最终用户分析添加到DocFx以跟踪每个文档页面的使用情况?

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

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

代码语言:javascript
复制
<!-- 
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>
EN

回答 1

Stack Overflow用户

发布于 2017-06-25 22:43:46

不需要PostProcessor。您可以通过自定义模板来实现这一点。有关更多信息,请访问official tutorialthis question。您可以在partials/head.tmpl.partial中添加代码。它会影响所有生成的页面。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44471300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档