iFUEL INTERACTIVE

A NY Interactive Agency and a Division of Agency212

See you on Flickr See you on Twitter See you on FaceBook Subscribe
FIX Google Analytics _gaq is not defined In Magento 1.4.0.1
July 2nd, 2010  |  1 COMMENT  |  Development, Magento

Locate: /app/design/frontend/base/default/layout/googleanalytics.xml

Replace With:

<default>
<!-- Mage_GoogleAnalytics -->
<reference name="before_body_end">
<block type="googleanalytics/ga" name="google_analytics" as="google_analytics" />
</reference>
</default>
</layout>

^ This will move the Google Analytics code to before the closing of the HTML </body> tag (for faster page load times)

Locate: /app/code/core/Mage/GoogleAnalytics/Block/ga.php

Replace at around LINE 171:

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
_gaq.push(["_trackPageview", "'.$this->getPageName().'"]);
(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);
})();

//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
COMMENTS

LEAVE COMMENT
Your name:  (required)

Your email:  (required, will not be published)

Website:  (not required)

Message:  (required)

Categories
Archives
Tags
From Our Twitter (@ifuel)
Our Interactive Agency on Facebook
Copyright iFuel Interactive © 2010. All Rights Reserved.
Going up? Click here.A NY INTERACTIVE AGENCY