将谷歌分析添加到TYPO3中

将谷歌分析添加到TYPO3中,typo3,typoscript,typo3-6.1.x,Typo3,Typoscript,Typo3 6.1.x,我使用打字脚本(在模板中)添加了用于Google Analytics的javascript: page.headerData.124034=文本 page.headerData.124034.value( var _gaq=_gaq | |[]; _gaq.push([''u setAccount',UA-#-#-#-#-#-#-#-#']); _gaq.push([''u gat.'u anonymizeIp']); _gaq.push([''u trackPageview']); (功能()

我使用打字脚本(在模板中)添加了用于Google Analytics的javascript:

page.headerData.124034=文本
page.headerData.124034.value(
var _gaq=_gaq | |[];
_gaq.push([''u setAccount',UA-#-#-#-#-#-#-#-#']);
_gaq.push([''u gat.'u anonymizeIp']);
_gaq.push([''u trackPageview']);
(功能(){
var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;
ga.src=('https:'==document.location.protocol?'https://ssl' : 'http://www“)+”.google analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);
})();
)
TYPO3在前端渲染:

 <!-- Google Analytics -->

 <!-- Google Analytics End -->

因此,缺少完整的脚本部分。我的代码在Type6.1.3上运行得非常好。我想当我更新到TYPO3版本6.1.4或6.1.5时,它停止工作了


有人知道如何让它再次工作吗?

可能文本类型不再接受脚本标记

尝试使用:

page.includeFooterJS.c (
    <script type=”text/javascript”>
        alert(“Yes, scripts can also be added inline.”);
    </script>
)
page.includeFooterJS.c(
警报(“是的,脚本也可以内联添加。”);
)
或:
您的模板可能有问题,例如,其他模板正在覆盖此值。 是否已检查模板对象浏览器中的值是否正确

我已经测试了您共享的代码,它在TYPO3 v8.7中没有问题

page.includeFooterJS.c (
    <script type=”text/javascript”>
        alert(“Yes, scripts can also be added inline.”);
    </script>
)