Knowledge Base

How to use Google Analytics with Magento

This article discusses how to use Google Analytics with your Magento site to obtain statistics about visitor traffic.

Using Google Analytics with Magento

Google Analytics provides detailed statistics about visitor traffic to your site. To use Google Analytics with Magento (or with any other type of site), you must first sign up for a Google Analytics account at http://www.google.com/analytics and obtain a unique Tracking ID.

After you have set up a Google Analytics account and have the Tracking ID for your site, you can configure it for Magento. Unlike many other CMS and e-commerce applications, you do not have to install a separate plugin or module to use Google Analytics. Magento includes Google Analytics support by default.

Follow the appropriate procedure below for your version of Magento.

Magento 2

To enable Google Analytics for Magento 2, follow these steps:

  1. Log in to Magento as the administrator.
  2. On the left sidebar, click Stores, and then under Settings, click Configuration.
  3. Click SALES, and then click Google API.
  4. Click Google Analytics.
  5. In the Enable list box, select Yes.
  6. In the Account Number text box, type your Google Analytics tracking ID.
  7. To test individual pages in the store, in the Enable Content Experiments list box, select Yes.
  8. Click Save Config. Magento enables Google Analytics for your site immediately.
    It can take up to 24 hours for Google Analytics to change its status from Tracking Not Installed to Receiving Data.
Magento 1.9 and older versions

To enable Google Analytics for Magento 1.9 and older versions, follow these steps:

  1. Log in to Magento as the administrator.
  2. On the top menu bar, click System, and then click Configuration.
  3. On the left-hand menu bar, under SALES, click Google API.
  4. Click Google Analytics.
  5. In the Enable list box, select Yes.
  6. In the Type list box, select one of the following:
    • To use Universal Analytics, select Universal Analytics.
    • To use “classic” Google Analytics, select Google Analytics.
    If you are unsure which type to use, select Universal Analytics. It is newer and supports more features. For more information about Universal Analytics, please visit https://support.google.com/analytics/answer/2790010.
  7. In the Account Number text box, type your Google Analytics tracking ID.
  8. In the Enable IP anonymization list box, select one of the following:

    • To anonymize visitor IP addresses, select Yes.
    • To track visitor IP addresses, select No.
  9. Click Save Config. Magento enables Google Analytics for your site immediately.

    It can take up to 24 hours for Google Analytics to change its status from Tracking Not Installed to Receiving Data.

More Information

For more information about Google Analytics, please visit http://www.google.com/analytics.