1
我想添加Google Anlytics到我的所有html页面。下面的页面被称为rates.html。jquery - 谷歌分析不拉在页脚
<html>
<head>
<title></title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function(){
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="footer"></div>
</body>
</html>
在我footer.html我有以下几点:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/stylesheet.css" />
<title>Footer</title>
</head>
<body>
<p align="center">Numbers: +244 (0) 00000000 | Lodge: +244 (0) 00000000 <br />
<a href="mailto:[email protected]%20" class="Copy_link1">[email protected] </a>| <a href="mailto:[email protected]" class="Copy_link1">[email protected]</a></p>
<p align="center">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus temporibus sequi saepe eius dolorem iusto deleniti, numquam nemo provident sunt accusantium esse cum similique harum reprehenderit illum, facilis laudantium soluta!.</p>
<p align="center"><a href="http://www.sidney.com/" class="Copy_link1">SEO Powered by Ruby Digital</a></p>
<script>
(function(i,s,o,g,r,a,m) { i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o) [0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-12813356-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('send', 'pageview');
</script>
</body>
</html>
我可以看到段落content.Problem是我刚刚意识到rates.html和其它的HTML页面真的不拉动分析,因为当我查看页面源时,没有显示分析。
我该怎么办了谷歌分析也显示在我的
我不能这样做。就像我提到的,rates文件是pf html扩展名。在php文件中,它可以使用包含。但在HTML文件不起作用,这就是为什么我试图jQuery代码。 –
已更新的答案,然后@WosleyAlarico –
...在此先感谢。我尝试之前作为第一次尝试,它也没有工作。我知道它应该工作,但由于某种原因,它不会 –