3

What seems to be the case why this code is not working.

The account is set to Universal Analytics.

The account is enabled for ecommerce.

The chrome extension for debugging analytics shows a lot of stuff is happening.

But days pass by and no tracking.

Here is the output:

(Note: Account and domain data is substituted for this public post.)

<!-- BOF: Google Analytics E-commerce Tracking -->
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-00000000-0', 'my.domain.com');

  ga('require', 'ecommerce', 'ecommerce.js');

  ga('ecommerce:addTransaction', {
    'id': '12345',
    'affiliation': 'My Store',
    'revenue': '200',
    'shipping': '0',
    'tax': '40',
    'currencyCode': 'EUR'
  });

  ga('ecommerce:addItem', {
    'id': '00001',
    'name': 'Item 1',
    'sku': 'V4C3D5R2Z6',
    'category': 'stuff',
    'price': '80',
    'quantity': '2'
  });

  ga('ecommerce:send');
</script>
<!-- EOF: Google Analytics E-commerce Tracking -->

Further below on the page there is the standard pageview.

<!-- BOF: Universal Analytics -->
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-00000000-0', 'my.domain.com');
  ga('send', 'pageview');
</script>
<!-- EOF: Universal Analytics -->
4

1 回答 1

0

电子商务代码似乎与常规跟踪代码冲突。使用多跟踪器方法可以解决此问题。

ga('create', 'UA-00000000-0', {'name': 'myTracker'});

...
于 2013-08-14T10:53:43.547 回答