0
我有這樣如何在不使用插件的情況下將Google Analytic添加到我的WordPress網站?
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("xx-xxxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script>
讓我怎麼使用它在我的網站腳本?請幫助我獲得解決方案..
這是一些嚴重過時的分析代碼,應該在當今時代根本不使用。如果你將它添加到標題中,它可能會阻止你的頁面呈現,直到谷歌代碼被加載(這就是爲什麼谷歌引入了asychnronous代碼),所以如果你必須使用它,把它放在頁腳。 –
感謝您的有用建議.. –