1
爲什麼我需要使用:的爲什麼Google Analytics需要動態加載?
<script type="text/javascript" charset="utf-8">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xxxxxxxxxx']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function() {
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);
})();
//]]>
</script>
代替
<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'xxxxxxxxxx']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
//]]>
</script>
所以我可以做到這一點: <腳本異步= 「」 SRC = 「http://www.google-analytics.com/ga.js」> 或: <腳本異步= 「真」 SRC = 「http://www.google-analytics.com/ga.js」> – user000001