2011-04-27 121 views
1

谷歌電子商務代碼中是否有任何問題。我們有噸的交易,但沒有顯示 了在電子商務......之前加載ga.js腳本所以_gat對象還沒有提供被執行谷歌電子商務代碼問題

<script type="text/javascript"> 
     try{ 
      var pageTracker = _gat._getTracker("UA-XXXXXX-1"); 
     pageTracker._trackPageview(); 
      pageTracker._addTrans(
      "429",   // order ID - required 
      "louiseh", // affiliation or store name 
      "11.65",   // total - required 
      "3.15",   // shipping 
      "Santa Clara",  // city 
      "California",  // state or province 
     ); 
    //Add each items in the order 

      pageTracker._addItem(
      "429", // order ID - necessary to associate item with transaction 
      "99",   // SKU/code - required 
      "Sandwich WrapIt!",  // product name 
      "Home, Garden & Pets", // category or variation 
      "8.5",   // unit price - required 
     "1", 
     ); 
    //Now submit the transaction 
    pageTracker._trackTrans(); //submits transaction to the Analytics server 
     } catch(err) {} 
    </script> 


<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-1"); 
pageTracker._trackPageview(); 
} catch(err) {}</script> 

回答

0

電子商務代碼。錯誤正在拋出,但未顯示在錯誤控制檯中,因爲它包含在try/catch塊中。如果你重新排序腳本塊,那麼它應該工作:

<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-XXXXXX-1"); 
     pageTracker._trackPageview(); 
     pageTracker._addTrans(
     "429",   // order ID - required 
     "louiseh", // affiliation or store name 
     "11.65",   // total - required 
     "3.15",   // shipping 
     "Santa Clara",  // city 
     "California"  // state or province 
    ); 

     //Add each items in the order 
     pageTracker._addItem(
     "429", // order ID - necessary to associate item with transaction 
     "99",   // SKU/code - required 
     "Sandwich WrapIt!",  // product name 
     "Home, Garden & Pets", // category or variation 
     "8.5",   // unit price - required 
     "1" 
    ); 
     //Now submit the transaction 
     pageTracker._trackTrans(); //submits transaction to the Analytics server 
    } catch(err) {} 
</script> 
+0

謝謝伊萬。我推動了這些變化,並等待結果反映到Google電子商務中,因爲這需要24小時。 – Anshu 2011-04-28 05:11:27

+0

所以我改變了順序和代碼似乎仍然不工作?有沒有一種方法可以調試此代碼。我們在過去兩天內的銷售額達到了約10家,但沒有一家通過分析報告過 – Anshu 2011-05-01 03:09:22

+0

您是否在爲每筆交易使用唯一的「訂單ID」? – 2011-05-01 10:49:18

相關問題