6/05/2010

Google Analytics code bug in Magento 1.4.0.1

We just released a site based on the latest community release of Magento 1.4.0.1. All went well until the point when we enabled Google Analytics for the site.

Firebug was showing an error: _gaq is not defined

google analytics error in magento 1.4.0.1

So there was a variable issue with the extra javascript analytics code inserted by Magento. A quick google search revealed that this issue was already reported in the Magento bug tracker and a solution/workaround provided.

The problem is in file: app/code/core/Mage/GoogleAnalytics/Block/Ga.php around line 170. Adding: var _gaq = _gaq || []; fixes the issue.

Easy fix, however, this sort of bug is something that shouldn’t have slipped through testing and quality control.

No comments:

Post a Comment