Analytics
3.9K members online now
3.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

New Universal analytics code is not tracking in google analytics

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 
I  have update the code form old ga.js to new  analytics.js  from the developer network (https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#implementation). 
 
After completion of a transaction I was able to see the transaction details in source code but these transaction details are not tracking in google analytics.
 
The following is the code that I am able to see in the source code on my confirmation page. Please review the below source code and let us know how to resolve it.
 

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/analytics.js' type='text/javascript'%3E%3C/script%3E&quotSmiley Wink);
try{
ga('create','UA-XXX','auto');
ga('send', 'pageview');
ga('require', 'ecommerce');
 
ga('ecommerce:addTransaction' , { 
'id' : '167451',
 'affiliation' : XXX',
 'revenue' : '39.99',
 'shipping' : '8.99',
 'tax' : '2.80'
});
ga('ecommerce:addItem', {
'id' : '167451',
 'name' : 'DryTech Basic V Neck Liner',
 'sku' : 'CB149',
 'category' : 'Cheer-InStockPracticeandTeamWear-WomensLongTops(GKEliteMasterCatalog)',
 'price' : '39.9900',
 'quantity' : '1'
 });
ga('ecommerce:send');
 
Thanks,
Murali
 

Re: New Universal analytics code is not tracking in google analytics

A T
Participant ✭ ✭ ✭
# 2
A T
Participant ✭ ✭ ✭

GA debugger: https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

 

Please check in chrome console tab for debugging.

Marked as Best Answer.
Solution
Accepted by topic author Murali K
November 2015

Re: New Universal analytics code is not tracking in google analytics

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

syntax error for :

 

 'affiliation' : XXX',

 

should be:

 

 'affiliation' : 'XXX',

Re: New Universal analytics code is not tracking in google analytics

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
Hi,

Thank you for your response.
the syntax is correct in code but i just copied here wrong.
like you said it is like below code only source code.
'affiliation' : 'XXX',

Thanks,
Murali

Re: New Universal analytics code is not tracking in google analytics

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi,

Can you please let me know how to resolve this issue. As you said the affiliation is in correct format only ('affiliation' : 'XXX') when I see in source still am unable to track in Google analytics. The below is the source code I got in confirmation code. Can you please review the source code and give your inputs in solving this issue.

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/analytics.js' type='text/javascript'%3E%3C/script%3E&quotSmiley Wink);
try{
ga('create','UA-XXXX-1','auto');
ga('send', 'pageview');
ga('require', 'ecommerce');
ga('ecommerce:addTransaction' , {
'id' : '167464',
'affiliation' : 'XXX',
'revenue' : '49.99',
'shipping' : '8.99',
'tax' : '3.49'
});

ga('ecommerce:addItem', {
'id' : '167464',
'name' : 'Long Sleeve Mystique Accent Uniform Top','
sku' : 'CB164',
'category' : 'Cheer-InStockPracticeandTeamWear-WomensLongTops(GKEliteMasterCatalog)',
'price' : '49.9900','
quantity' : '1
'});
ga('ecommerce:send');


Thanks,
Murali