Add Google Analytics or StatCounter code to Magento Sites

A lot of people want to add Google Analytics and StatCounter javascripts to their Magento sites, but don’t know where to add the code.

I find the best place is to go to CMS > Static Blocks > Footer Links and add them there.

In some cases however (older versions of Magento perhaps), you may be better off editing the footer.phtml file in the app > design > frontend > default > currenttheme > template > page > html folder.

Google Analytics also needs to be enabled in Magento. To do this, first find the Web Property ID of the Google Analytics profile. This is right on the first page of your site’s profile, next to your domain name and starts UA… Copy it, then go to the Magento admin interface, then System> Configuration> Google API> Google Analytics. Change Enable to Yes and paste in the Web Property ID. Save the changes and hopefully, that’s it.

other page


4 Comments

  1. Designermagic

    Additional info for earlier versions of Magento added.

    • Stuart

      Annie – thank you! This is really good to know.

  2. Alex

    Thanks for sharing this post, It helped me a lot while adding analytic to my ecommerce store, and this post also found useful.

It's good to talk!

Your email address will not be published. Required fields are marked *