javascript - What is wrong with my Google Universal Analytics code? -
what seems case why code not working.
the account set universal analytics.
the account enabled ecommerce.
the chrome extension debugging analytics shows lot of stuff happening.
but days pass , no tracking.
here output:
(note: account , domain data substituted 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 page there 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 -->
it seems ecommerce code in conflict regular tracking code. using multiple tracker method solve case.
ga('create', 'ua-00000000-0', {'name': 'mytracker'}); ...
Comments
Post a Comment