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 –
...在此先感謝。我嘗試之前作爲第一次嘗試,它也沒有工作。我知道它應該工作,但由於某種原因,它不會 –