SEO for Magento: Google Analytics

SEO would be irrelevant if there wasn’t a way to analyze the stream of traffic through your optimized Magento or eCommerce website.

There are numerous analytics bundles, services, and tools out there, but the most popular by far is Google Analytics (

Google Analytics screenshot

Keeping in mind the end goal to set up Analytics adequately on our Magento store, we will need to enter our Google Analytics Account Number (tracking ID) in the admin panel. It is also recommended that we activate eCommerce tracking from within our Google Analytics account.

To do that follow the steps below:

ecommerce tracking

  1. Log in to our Google Analytics account and navigate to your website’s account page by clicking on proper folder.
  2. Click on Admin located in the header.
  3. Within this section, we should see three columns: Account, Property, and View. If we wish to find out our Tracking ID, click on Property Settings under the Property column; we can then copy/paste our Tracking ID from here.
  4. To turn on E-commerce tracking, we should click on View Settings within the View section and then scroll down to Ecommerce Settings and ensure that the toggle is set to ON.
  5. Now that we have our tracking ID and have enabled E-commerce tracking in Google Analytics, we should navigate to our Magento administration panel and then go to System > Configuration Google API > Google Analytics.
  6. Paste in our tracking ID into the Account Number field, set Enable to Yes, and then click on Save Config.

Google API Magento

Since we have set up analytics, we will discover a ton of information is now available to us (assuming you have given Google time to index your site and collect some good data), including the ability to track revenue by source and to work out our most effective conversion paths.

To double-check that our website is getting the Google Analytics JavaScript code, we can explore our home page page source. To find your source code, right click on the page and “view page source”.  Just inside the <body> tag, we should find code similar to the following:


// our <script> tag containing our tracking code here


Here is an example:

Google analytics source code

On the off chance that we don’t see this code, it may be the case that the template file has been altered and the tag that includes our Google Analytics code has been removed. If this is the case, double-check your standard template files (1column.phtml, 2columns-left.phtml, 2columns-right.phtml, and 3columns.phtml, usually found within app/design/frontend/yourpackage/yourtheme/template/page) to very that these two snippets of code are in place and working.

<?php echo $this->getChildHtml(‘after_body_start’) ?>

<?php echo $this->getChildHtml(‘before_body_end’) ?>

Lastly, Conversions will not be tracked if the proper code is not added to the success page once someone places an order.

  • Generally, adding the tracking code to the Magento HTML Head through Magento’s configuration (Configuration > Web > HTML Head) should be enough. If for whatever reason it doesn’t seem to be tracking on the success page (sometimes a theme or extension will overwrite parts of Magento’s default functionality), then you might have to add the code in manually.
  • To do this, using your FTP/SFTP client, navigate to /app/design/frontend/template/checkout/success.phtml
  • Open that file in an editor and add the Google Analytics tracking code to the very bottom of the file. Save it, and reupload it.