Magento. How to add Google Analytics code

In order to add the Google Analytics code, you should perform the following:

1) The first step is locating your account ID in Google. You will first need to access your tracking code from within your Google Analytics account

2) You should get the code similar to the code below:

<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);

3) ‘UA-XXXXX-X’ in your code ( where XXXXX-X stands for your Account ID number) is your Google Account ID.

4) Log into your Magento Admin Area and navigate to System -> Configuration -> Google API:

5) Expand the ‘Google Analytics’ row, enable Google Analytics and insert your Account ID into the box.

6) Click ‘Save Config’ button at the top right to save the changes.