开发者

Google Analytics not tracking transactions

开发者 https://www.devze.com 2022-12-19 04:22 出处:网络
I\'m having trouble getting Google Analytics to track transactions for commerce. Here\'s the code I\'m generating on my order confirmation page.

I'm having trouble getting Google Analytics to track transactions for commerce. Here's the code I'm generating on my order confirmation page.

I don't know how to debug this either, I can't find information on how to get error codes out of google's js. I'd run it in firebug's console if I could. At this point I'm stuck on how to proceed.

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-########-#']);
    _gaq.push(['_setDomainName', '.mydomain.com']);
    _gaq.push(['_trackPageview']);


    _gaq.push(['_addTrans',
      '117',           // order ID - required
      'StoreName.com',  // affiliation or store name
      '35.96',          // total - required
      '0',           // tax
      '0',              // shipping
      '',       // city
      '',     // state or province
      ''             // country
    ]);
    _gaq.push(['_addItem',
      '117',           // order ID - required
      '1',           // SKU/code - required
      '1 Pack',        // product name
      'Catagory5',          // catagory   
      '35.96,          // unit price - required
      '1'               // quantity - required
    ]);
    _gaq.push(['_trackTrans']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('h开发者_C百科ttps:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();
</script>

Thank you for any suggestions.


Checkout this page on Google Code. It provides an example of what your trying to do.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号