Analytics
2K members online now
2K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Analytics is not tracking ecommerce

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I am trying to get Analytics e-commerce to work, but I have no luck setting it up.
Analytics however does register the "goals" I have setup.

 

Here is the code I use for tracking, probably I am doing something wrong, but can't figure out what I am doing wrong...

 

In the HEAD tags:

<script type="text/javascript">(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', 'MY GOOGLE-NUMBER', 'auto');
ga('send', 'pageview');
</script>

In the BODY tag:

 

<script>ga('require', 'ecommerce');

ga('ecommerce:addTransaction', {
  'id': 1446717481,
  'revenue': 59.76;,
  'shipping': 0, // Shipping.
  'tax': 12.55  });
  
  ga('ecommerce:addItem', {
'id': 1446717481,
'name': product name1,
'sku': 403,
'price': 47.88,
'quantity': 1
});

ga('ecommerce:addItem', {
'id': 1446717481,
'name': .product name2,
'sku': 14,
'price': 11.88,
'quantity': 1
});


ga('ecommerce:send');</script>

 

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by Dave_Davis (Top Contributor)
November 2015

Re: Analytics is not tracking ecommerce

Top Contributor
# 2
Top Contributor

Hi Nitroserve,

 

You have a syntax error (an extra semicolon) in your transaction tracking code here: 'revenue': 59.76;,
Also you need to quote the product names. Please find the corrected code below:

 

<script>
ga('require', 'ecommerce');

ga('ecommerce:addTransaction', {
  'id': 1446717481,
  'revenue': 59.76,
  'shipping': 0, // Shipping.
  'tax': 12.55  });
  
  ga('ecommerce:addItem', {
'id': 1446717481,
'name': 'product name1',
'sku': 403,
'price': 47.88,
'quantity': 1
});

ga('ecommerce:addItem', {
'id': 1446717481,
'name': 'product name2',
'sku': 14,
'price': 11.88,
'quantity': 1
});

ga('ecommerce:send');
</script>

Hope this helps.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

View solution in original post

Marked as Best Answer.
Solution
Accepted by Dave_Davis (Top Contributor)
November 2015

Re: Analytics is not tracking ecommerce

Top Contributor
# 2
Top Contributor

Hi Nitroserve,

 

You have a syntax error (an extra semicolon) in your transaction tracking code here: 'revenue': 59.76;,
Also you need to quote the product names. Please find the corrected code below:

 

<script>
ga('require', 'ecommerce');

ga('ecommerce:addTransaction', {
  'id': 1446717481,
  'revenue': 59.76,
  'shipping': 0, // Shipping.
  'tax': 12.55  });
  
  ga('ecommerce:addItem', {
'id': 1446717481,
'name': 'product name1',
'sku': 403,
'price': 47.88,
'quantity': 1
});

ga('ecommerce:addItem', {
'id': 1446717481,
'name': 'product name2',
'sku': 14,
'price': 11.88,
'quantity': 1
});

ga('ecommerce:send');
</script>

Hope this helps.


Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Analytics is not tracking ecommerce

A T
Participant ✭ ✭ ✭
# 3
A T
Participant ✭ ✭ ✭

Please check the syntax at: https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

 

Alsoe values being passed should be in single quotes.

 

ga('ecommerce:addTransaction', {
'id': '1446717481',
'revenue': '59.76',
'shipping': '0', // Shipping.
'tax': '12.55' });

Analytics is not tracking ecommerce

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Our e-commerce website enabled Ecommerce Reporting on the Analytics platform. However, we are not using the e-commerce plugin. Can this cause issues?? We havebeen having conversion issues and don't know if we can attribute it to this