Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 3
No Google Analytics eCommerce tracking data since Magento 1.4.2.0 upgrade
 
owebia
Mentor
 
Avatar
Total Posts:  1227
Joined:  2008-07-11
France, Morteau
 

Hi,

It’s seems that since Magento 1.4.2.0 upgrade, I don’t have any ecommerce data tracked by Google Analytics.

Here is the js code displayed on my checkout success page :

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
//<![CDATA[
    
(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';
        (
document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    
})();

    var 
_gaq _gaq || [];

_gaq.push(function() {
    
// the global variable is created intentionally
    
pageTracker _gat._getTracker('UA-XXXXXXXX-X');
    
pageTracker._trackPageview();
});

_gaq.push(['_addTrans''100000431''XXXXXXXXX''22.5800''3.7000''15.0000''XXX''XXX''FR']);
_gaq.push(['_addItem''100000431''8097SX13''Fleurs artificielles Orchidée artificielle cymbidium Ã  6 fleurs oranges''''3.8800''1.0000']);
_gaq.push(['_trackTrans']);
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->

I have all page visit tracking data but no transaction tracked.

Is there a bug in the last version of app/code/core/Mage/GoogleAnalytics/Block/Ga.php ?

Can it be due to the fact that pageTracker is not defined anywhere ?

Thanks in advance.

A.L.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Prad
Member
 
Total Posts:  72
Joined:  2008-11-12
 

Hi,

Are you using any other extensions related to google analytics? For me Google code was not appearing in the script so both analytics and eCommerce tracking was not working and even I was using Fooman Google Analytics extension.

If this might help you, here is what I had done.
After getting deeper in codes I found that using the code below to get Google code is no more used in Magento 1.4.2.0

$this->getAccount()
Even in file Ga.php, it has been mentioned that this function is deprecated
/**
     * @deprecated after 1.4.1.1
     * @see _toHtml()
     * @return string
     */
    public function getAccount()
    
{
        
return '';
    
}

So instead of using this function I fetched it using

Mage::getStoreConfig(Mage_GoogleAnalytics_Helper_Data::XML_PATH_ACCOUNT)

And google code appeared and was working.

Hope this might help you in some way.

Regards

 
Magento Community Magento Community
Magento Community
Magento Community
 
owebia
Mentor
 
Avatar
Total Posts:  1227
Joined:  2008-07-11
France, Morteau
 

Thank you but my problem is different. As you can see upper, I have a google analytics code displayed on checkout success page but this code doesn’t work for ecommerce tracking (it works for standard tracking).

A.L.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Prad
Member
 
Total Posts:  72
Joined:  2008-11-12
 

Did you enable ecommerce tracking in your google analytics account?

 
Magento Community Magento Community
Magento Community
Magento Community
 
owebia
Mentor
 
Avatar
Total Posts:  1227
Joined:  2008-07-11
France, Morteau
 

Hi,

Yes, and it worked before.

A.L.

 
Magento Community Magento Community
Magento Community
Magento Community
 
TigPT
Jr. Member
 
Total Posts:  9
Joined:  2010-03-15
 

I have the sample problem as owebia

Do anyone have a solution? I’m getting normal google analytics tracking but not tracking adwords or ecommerce information.

Didn’t changed a sing from the 1.4.1.1, but after upgrade to 1.4.2.0 it started to tracking this way.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdz123
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-07-24
Technomadic
 

Simular problem here. Strangely i do have the odd transaction coming up on the e-Commerce section of analytics but only a tiny percentage of the transactions that should be there.

I’ve checked the GA javascript is on the success page, no problem there. I notice that ‘Waiting for http://ssl.googleanalytics.com....’ is displayed for a minute or two implying the data is having trouble being sent.

I wonder if it is only tracking those very few clients who happen to leave their browser open long enough for the data to be sent ? This could explain why most of my transactions are not being tracked.

Any updates / help appreciated smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdz123
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-07-24
Technomadic
 

Just figured out that its only tracking my Google Checkout orders not any of my Paypal / CC ones (ignore my time out assumption above). One thing i changed after the upgrade way the Paypal \"Transfer Cart Line Items\” option to Yes. I\’ve reverted this to No and will see if this is causing the problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdz123
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-07-24
Technomadic
 
sdz123 - 14 January 2011 04:49 AM

I\’ve reverted this to No and will see if this is causing the problem.

This isn’t the problem. Just checked google analytics e-commerce and its still just tracking the google checkout orders. :(

Ive also noticed that my Google Checkout orders are not being marked as shipped by Magento when checking the google checkout orders inbox. I wonder if this is related ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
elitriona
Sr. Member
 
Total Posts:  106
Joined:  2008-10-23
 

I’m also having this problem after upgrading to 1.4.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdz123
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-07-24
Technomadic
 

Im still stuck on this problem. One thing i tried that didn’t work was to move the Analytics into the header section which was recommended by Google : http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

I’ve also noticed that the success page google analytics code differs a bit to the code i their example. Im going to try this next… Will post on what happens.

 
Magento Community Magento Community
Magento Community
Magento Community
 
faken
Jr. Member
 
Total Posts:  16
Joined:  2009-11-13
 

I have this problem also. Does anyone know how to solve it?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
faken
Jr. Member
 
Total Posts:  16
Joined:  2009-11-13
 

The release notes for 1.5.0-alpha1 state the following fix:

- Fixed Google Analytics e-commerce tracking not working

So, how to fix this in 1.4.2.0...?

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdz123
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-07-24
Technomadic
 

Thanks for the tip.

I’ve replaced my current Ga.php with the alpha1 version found here :
http://svn.magentocommerce.com/source/branches/1.5-trunk/app/code/core/Mage/GoogleAnalytics/Block/

I see the output change slightly so hopefully this will work out. Should know by tomorrow.

 
Magento Community Magento Community
Magento Community
Magento Community
 
owebia
Mentor
 
Avatar
Total Posts:  1227
Joined:  2008-07-11
France, Morteau
 

I think the solution is here (take a look to the method _getPageTrackingCode) :

http://svn.magentocommerce.com/source/branches/1.5-trunk/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

You can compare the file with it’s previous version used in Magento 1.4 :

http://svn.magentocommerce.com/source/branches/1.4/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

You can copy the file app/code/core/Mage/GoogleAnalytics/Block/Ga.php to app/code/local/Mage/GoogleAnalytics/Block/Ga.php
Then replace the method _getPageTrackingCode by :

protected function _getPageTrackingCode($accountId)
    
{
        $pageName   
trim($this->getPageName());
        
$optPageURL '';
        if (
$pageName && preg_match('/^\/.*/i'$pageName)) {
            $optPageURL 
", '{$this->jsQuoteEscape($pageName)}'";
        
}
        
return "
_gaq.push(['_setAccount', '{
$this->jsQuoteEscape($accountId)}']);
_gaq.push(['_trackPageview'{
$optPageURL}]);
"
;
    
}

I have not tested yet but I will do it soon.

A.L.

EDIT: @sdz123 : sorry, same solution posted at the same time

 
Magento Community Magento Community
Magento Community
Magento Community
 
faken
Jr. Member
 
Total Posts:  16
Joined:  2009-11-13
 

Everything is working now :D
Another Magento bug solved wink

Thanks!!!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 3