Add Google Analytics to your Magento Store

If you want to add Google Analytics to your Magento store, don’t go diving into templates or setting fancy layout updates.. The good folks at Magento have made it nice and easy; simply enable Google Analytics in your Magento admin.

  1. Sign up for your Google Analytics account here:
    http://www.google.com/analytics/sign_up.html
  2. Make note of your Google Analytics account number,
    e.g. UA-xxxxxx-x
  3. Go to your Magento admin and visit the following screen:
    System > Configuration > Sales > Google API
  4. Expand the Google Analytics block, Enable and enter your Account Number

Sit back and watch those stats start rolling in..
Doesn’t get much simpler than that – cheers Mage and Goog 🙂

There’s a known javascript bug with the Google Analytics implementation in Magento version 1.4.0.1
http://www.magentocommerce.com/bug-tracking/issue?issue=8658

As mentioned in the bug report, this will be fixed in the next stable release, so until then the fix is simple:

Edit the following core file:
magento/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

Add the following line at line at around line 180 just above _gaq.push

var _gaq = _gaq  || [];

Comments are closed.