,你必須添加跟蹤與谷歌分析一個網頁看起來像代碼:在document.write上使用unescape加載javascript有什麼好處?
<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("UA-XXXXX");
pageTracker._trackPageview();
} catch(err) {}</script>
什麼做這些線的優勢:
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
與這些行:
document.write("<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'><\/script>");
我寫了一些類似的代碼(加載JavaScript「通過」文件寫入),但它不使用unescape,我想知道如果我應該w谷歌分析示例。
難道是確定使用文件撰寫(「\ x3Cscript SRC =「」 + gaJsHost +」搜索引擎分析。 com/ga.js'type ='text/javascript'\ x3E \ x3C/script \ x3E「); – TJR 2009-08-04 03:04:40