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

Tried all fixes, Google Analytics broken in Magento 1.4.2.0 and 1.6.0.0, ideas? 
 
animalelement
Jr. Member
 
Total Posts:  17
Joined:  2009-02-20
 

I have two websites, one is using 1.4.2.0 the other 1.6.0.0. Put the UA-xxxx number in the setup area for both.

Google is saying the Tracking Code is not Installed for both.

Tried installing the Fooman Google Analytics module on 1.4.2.0 to see if that would help. The Javascript looks different but it still doesn’t work.

Here’s what 1.4.2.0 with the Fooman module is showing when I view source:

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
//<![CDATA[
            
(function() {
                
var ga document.createElement('script'); ga.type 'text/javascript'ga.async true;ga.src 'http://www.google-analytics.com/ga.js';
                var 
document.getElementsByTagName('script')[0]s.parentNode.insertBefore(gas);
            
})();
            var 
_gaq _gaq || [];

            
_gaq.push(["_setAccount""UA-29971406-1",["_setDomainName","animalelement.com"]["_trackPageview","/about.html"]["_trackPageLoadTime"]);
            
_gaq.push(["t2._setAccount""57356609"]["t2._trackPageview","/about.html"]["_trackPageLoadTime"]);



            if(
Ajax.Responders){
                Ajax
.Responders.register({
                  onComplete
: function(response){
                    
if(!response.url.include("progress")){
                        
if(response.url.include("saveOrder")){
                            _gaq
.push(["_trackPageview""/about.html""/opc-review-placeOrderClicked"]);
                            
_gaq.push(["t2._trackPageview""/about.html""/opc-review-placeOrderClicked"]);
                        
}else if(accordion.currentSection){
                            _gaq
.push(["_trackPageview""/about.html/"accordion.currentSection]);
                            
_gaq.push(["t2._trackPageview""/about.html/"accordion.currentSection]);
                        
}
                    }
                  }
                }
);
            
}

//]]>
</script>

<!-- END GOOGLE ANALYTICS CODE -->

Here’s what 1.6.0.0 without fooman shows.

<!-- 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(['_setAccount''UA-30014610-1']);
_gaq.push(['_trackPageview']);


//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Here’s working output (view source) from v1.4.1.1 as modified per this post over on Magentist. The modifications are made to app/code/core/Mage/GoogleAnalytics/Block/Ga.php and are necessary because the javascript has been updated to work better.

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
//<![CDATA[
    
var _gaq _gaq || [];
    
_gaq.push(["_setAccount""UA-xxxxxx-1"]);
    
_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 
document.getElementsByTagName('script')[0]s.parentNode.insertBefore(gas);
    
})();
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->

For Version 1.4.2.0, the GoogleAnaltyics module was rewritten with a lyrical deviation from the Google tracker code that breaks further _gaq.push() from being used. Fix Here: http://www.magentocommerce.com/boards/viewthread/216702/P30/#t433061

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top