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 -->
Ala
Nice. This post helped me alot in my college assignement. Gratefulness to you for your information.
August 10, 2010 at 9:02 am