<div class="codetitle"> <span><a style="CURSOR: pointer" data="30106" class="copybut" id="copybut30106" onclick="doCopy('code30106')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code30106"> <br><script type="text/javascript"> <BR>var _gaq = _gaq || []; //如果變數_gaq 存在,就等於他自己,否則為一個空數組<BR>_gaq.push(['_setAccount', 'UA-24479793-2']); //是個2維數組_gaq[0] = array(0=>'_setAccount', 1=>'UA-24479793-2');(設定本追蹤程式碼所對應的Google帳號) _gaq.push(['_trackPageview'] ); //是個2維數組_gaq[1] = array(0=>'_trackPageview');(定義按頁面追蹤) (function () { <BR>var ga = document.createElement('script'); //建立一個<script>標籤<BR>ga.type = 'text/javascript'; //<script type="text/javascript""> <BR>ga.async = true; //async 非同步script 似乎沒有這個屬性吧<BR>ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') '.google-analytics.com/ga.js '; // 如果是https: 就將src賦值為https://ssl.google-analytics.com/ga.js 否則http://www.google-analytics.com/ga.js var s = document.getElementsByTagName ('script')[0]; //然後找到目前頁面的第一個<script>標籤<BR>s.parentNode.insertBefore(ga, s); //將dom建立的<script>加入到頁面第一個<script>標籤的後邊。</script> </div>