How to Fix Google Analytics in Magento

Strangely, Google Analytics doesn’t work right out of the box on the most recent release of Magento (version 1.4.0.1), but luckily the solution is pretty easy:

1. Open this file: app/code/core/Mage/GoogleAnalytics/Block/Ga.php

2. Find the following line of code:
_gaq.push(["_setAccount", "' . $this->getAccount() . '"]);

3. Just above that line, add the following code:
var _gaq = _gaq || [];

Now Google Analytics should work fine 🙂

Leave a Reply

You must be logged in to post a comment.