Magento Fix for Google Analytics – Not Tracking – Not Receiving Data

Recently google had changed there tracking code.
You will need to make some modify before your site it back in track with Google Analytics.

Here’s what you will need to do.
create the folder structure like the following
/app/code/local/Mage/GoogleAnalytics/Block/

Then copy the file from /app/code/core/Mage/GoogleAnalytics/Block/Ga.php – by doing this step you will not alter the core of magento. Do like the following steps
Copy
/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
Paste to
/app/code/local/Mage/GoogleAnalytics/Block/Ga.php

Then open up the file /app/code/local/Mage/GoogleAnalytics/Block/Ga.php, you will need to change to the latest Google Analytic JavaScript code to the following.
Please open up /app/code/local/Mage/GoogleAnalytics/Block/Ga.php
Goto line 171
Original code

$this->addText('
<!-- 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);
    })();

    _gaq.push(["_setAccount", "' . $this->getAccount() . '"]);
    _gaq.push(["_trackPageview", "'.$this->getPageName().'"]);
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
');

Please change it to the following

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

Here’s the second step, do this step only if the google analytics tracking code are not presented in your theme. Do a quick search on your page source code. See if the google analytic are showing up or not. If it is not presented, you will need to do the following step to fix the problem.
Copy the file /app/design/frontend/base/default/layout/googleanalytics.xml
to your default theme folder /app/design/frontend/default/default/layout/googleanalytics.xml

And changed the code of this page from
Original Code

<reference name="after_body_start">
     <block type="googleanalytics/ga" name="google_analytics" as="google_analytics" />
</reference>

Replace with the following code

<reference name="before_body_end">
     <block type="googleanalytics/ga" name="google_analytics" as="google_analytics" />
</reference>

DS MobiShop – Our first magento theme landed on Themeforest


This DS MobiShop magento theme includes design for everything you need to launch your online store on MagentoCommerce, with the massive 16 color to choose from.
Demo are available at here
Continue Reading »

FIX for Magento 1.4 install does not work

This is a fix for the clean installation process of Magento 1.4.x.

Once you click in to the link provided, you will be direct to a page with the following message.

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: XXXXXXXXXXXXXXX

Continue Reading »

Page 1 of 11