Categories: Discuss Tracking and Implementation issues :

eCom tracking correctly installed, not populating report suite (source code included for review)

Showing 1-12 of 12 messages
eCom tracking correctly installed, not populating report suite (source code included for review) jhellitt 6/30/12 8:36 AM
I've been debugging an issue for a client of mine and am at my wits end. Any help is greatly appreciated
  • eCommerce tracking code suddenly stopped flowing into report suite on 6/26.
  • Site was on traditional snippet so after standard debugging methods showed no issues we updated to use async throughout the site to see if that helped
  • Moved tracking code to the head
  • Verified via the GA debugger that all methods are firing - no syntax errors, trailing spaces, etc.
  • Verified that all utm.gifs were being transmitted to GA servers with no time outs
  • Verified that nothing changed at the account level setting - eCommerce is still enabled, no filters applied to profile
  • We have the exact same code in lower environments (Dev, Stage) and the tracking beacons are being sent and received fine. The only difference of course is that these sites are pointing to a different account ID.

Source Code from a transaction:


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


_gaq.push(['_addTrans',
'606166', // order ID - required 
'LC_EN_US_WEB', // affiliation or store name 
'9.0', // total - required 
'0.87', // tax 
'5.5', // shipping 
'Baltimore', // city 
'MD', // state or province 
'US' // country 
]); 
// add item might be called for every item in the shopping cart 
// where your ecommerce engine loops through each item in the cart and 
// prints out _addItem for each 
_gaq.push(['_addItem', 
'606166', //  order ID - required 
'BB200-67', // SKU/code - required 
'Small Spatula', // product name 
'Silicone Utensils', // category 
'9.0',  // unit price - required 
'1.0' // quantity - required 
]); 

_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers  
(function() { 
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
})(); 
</script>	 	       	</head><body>
Re: eCom tracking correctly installed, not populating report suite (source code included for review) EdTalbot_YourCIO 6/30/12 11:48 AM
Try adding a _gaq.push(['_trackPageview']); after the trackTrans, that should do it.  For some reason that seems to be needed with the async code for ecom transactions.
Re: eCom tracking correctly installed, not populating report suite (source code included for review) AKungen 7/2/12 12:40 AM
We had the same problem, the report stopped receiving data at 0:00, 27th.

The profile with no filter works fine, only profiles with transaction ID filters have this problem.

Re: eCom tracking correctly installed, not populating report suite (source code included for review) Sampatirao 7/3/12 9:23 PM
Hi,

It Google has done some work, and the eCommerce data is appearing fine from Yesterday, 3rd July 19:00 GMT.

Regards
Sam.
Re: eCom tracking correctly installed, not populating report suite (source code included for review) andriansuwito 7/5/12 10:51 PM
Hi Jhellitt2, I'm sorry for hijacking your thread.
I have a similar problem problem, been trying to fix it since last month, so I guess it eliminates the possibility that it caused by the recent GA problem.

Anyway, this is a source code from a test transaction:

<script type="text/javascript">var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-5526865-1']);

_gaq.push(['_trackPageview']);

_gaq.push(['_addTrans',
    "23769",       // Order ID
    "3Gstore.de",     // Affiliation , 3Gstore.de
    "314.00",             // Total
    "0.00",              // Tax
    "2",                 // Shipping
    "",          // City
    "",        // State
    ""                // Country
     ]);
 
_gaq.push(['_addItem',
    "23769",         // order ID - necessary to associate item with transaction
    "413",         // SKU/code - required
    "iPhone 3GS 8GB Schwarz",      // product name - necessary to associate revenue with product
    'no set', // category or variation
    "314.000000",        // unit price - required
    "1"            // quantity - required
    ]);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();</script>

Located only in the order confirmation / thank you page.
Re: eCom tracking correctly installed, not populating report suite (source code included for review) Sampatirao 7/5/12 11:57 PM
Hi  Andrian,

You are missing the trackTrans method in the eCommerce code and also shift the _gaq.push(['_trackPageview']); to end of the eCommerce tracking code to work perfectly.

Regards
Sam
Re: eCom tracking correctly installed, not populating report suite (source code included for review) andriansuwito 7/8/12 8:54 PM
Hi Sampatirao,
Thank you for your response. But unfortunately I still not able to track any eComerce tracking. Though I changed the code according to your suggestion.

_gaq.push(['_setAccount','UA-5526865-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
    "23779",       // Order ID

    "3Gstore.de",     // Affiliation , 3Gstore.de
    "1.00",             // Total
    "0.00",              // Tax
    "2",                 // Shipping
    "",          // City
    "",        // State
    ""                // Country
     ]);
 
_gaq.push(['_addItem',
    "23779",         // order ID - necessary to associate item with transaction

    "413",         // SKU/code - required
    "iPhone 3GS 8GB Schwarz",      // product name - necessary to associate revenue with product
    'no set', // category or variation
    "314.000000",        // unit price - required
    "1"            // quantity - required
    ]);
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

About shifting
_gaq.push(['_trackPageview']); I don't quite get how I suppose to apply it on the code. Is it supposed to be added just before the function script?

_gaq.push(['_addItem',
    "23779",         // order ID - necessary to associate item with transaction

    "413",         // SKU/code - required
    "iPhone 3GS 8GB Schwarz",      // product name - necessary to associate revenue with product
    'no set', // category or variation
    "314.000000",        // unit price - required
    "1"            // quantity - required
    ]);
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    _gaq.push(['_trackPageview']);

    
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
Thank you in advance

Best regards
Re: eCom tracking correctly installed, not populating report suite (source code included for review) Sampatirao 7/9/12 3:03 AM
Hi,

Seems you must be getting java script error, _gaq is not defined? because in your code declaration for gaq is missing.

 var _gaq = _gaq || [];

Please check the complete code and use httpwatch to track the eCommerce request that is going to the GA server.

Regards
Sam
Re: eCom tracking correctly installed, not populating report suite (source code included for review) andriansuwito 7/9/12 7:19 PM
Hi Sampatirao,

In fact I did declare _gaq variable. The code I have posted above is from html sourcecode, therefore it hide any variable declaration.
However just to make things clear, this is my complete code

<script type="text/javascript">
 var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-5526865-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
    "{$order_id}",       // Order ID

    "3Gstore.de",     // Affiliation , 3Gstore.de
    "{$amount}",             // Total
    "0.00",              // Tax
    "{$j}",                 // Shipping

    "",          // City
    "",        // State
    ""                // Country
     ]);
 
{foreach from=$out item=v}
_gaq.push(['_addItem',
    "{$order_id}",         // order ID - necessary to associate item with transaction
    "{$v.id}",         // SKU/code - required
    "{$v.name}",      // product name - necessary to associate revenue with product

    'no set', // category or variation
    "{$v.price}",        // unit price - required
    "{$v.sku}"            // quantity - required
    ]);
{/foreach}

    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
   
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

Then I tracked the outgoing eCommerce request, but I can't figure out what really caused the problem
http://www.google-analytics.com/__utm.gif?utmwv=5.3.3&utms=5&utmn=1830168314&utmhn=www.3gstore.de&utmcs=UTF-8&utmsr=1920x1080&utmvp=1903x931&utmsc=24-bit&utmul=en-us&utmje=1&utmfl=11.3%20r300&utmdt=3Gstore.de&utmhid=1801357028&utmr=0&utmp=%2Forder-confirmation.php%3Fid_cart%3D194961%26id_module%3D226%26id_order%3D23782%26key%3D85c36d47173332c560969e03844fbddc&utmac=UA-5526865-1&utmcc=__utma%3D13804405.1196671469.1341831642.1341831642.1341831642.1%3B%2B__utmz%3D13804405.1341831642.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=q~

Best regards

Re: eCom tracking correctly installed, not populating report suite (source code included for review) Sampatirao 7/9/12 8:45 PM
Hi,

The outgoing request is not the eCommerce, its tracking Page view request.

Still in this code I can see that the trackepageview is above the eCommerce code, move that to after _trackTrans, and then check the requests to GA server.

Regards
Sam 
Re: eCom tracking correctly installed, not populating report suite (source code included for review) andriansuwito 7/19/12 9:28 PM
Hello,

I was in to the system upgrade last week, and now im back to GA eCom problem.
I have changed the code according to your suggestion as follows:

<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/953791375/?value=0&amp;label=PWRhCLH6vQMQj-fmxgM&amp;guid=ON&amp;script=0"/>


<script type="text/javascript">
var _gaq=_gaq||[];
_gaq.push(['_setAccount','UA-5526865-1']);
_gaq.push(['_addTrans',
    "{$order_id}",       // Order ID
    "3Gstore.de",     // Affiliation , 3Gstore.de
    "{$amount}",             // Total
    "0.00",              // Tax
    "{$j}",                 // Shipping
    "",          // City
    "",        // State
    ""                // Country
     ]);
 
{foreach from=$out item=v}
_gaq.push(['_addItem',
    "{$order_id}",         // order ID - necessary to associate item with transaction
    "{$v.id}",         // SKU/code - required
    "{$v.name}",      // product name - necessary to associate revenue with product
    'no set', // category or variation
    "{$v.price}",        // unit price - required
    "{$v.sku}"            // quantity - required
    ]);
{/foreach}
    _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
    _gaq.push(['_trackPageview']);

   
(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</noscript>

But still I don't see and outgoing request to GA eCom through httpwatch.
Any other solution to this problem will be greatly appreciated.

Regards
Re: eCom tracking correctly installed, not populating report suite (source code included for review) claudia_k 7/20/12 1:02 PM
Hi there,

The code in your last post is not correct - the Google Analytics script tag is within a noscript tag which does not make sense. Your code should look like this:

<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/953791375/?value=0&amp;label=PWRhCLH6vQMQj-fmxgM&amp;guid=ON&amp;script=0"/>
</noscript>


<script type="text/javascript">
var _gaq=_gaq||[];
_gaq
.push(['_setAccount','UA-5526865-1']);
... (the rest of the e-commerce tracking code in your post)
</script>

The call to trackPageview is usually done before the call to addTrans (see the example here: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce) but I don't know whether this hass any impact this way or that way.

Good luck

Claudia