was successfully added to your cart.

How to Integrate Google Analytics in Magento 2

By August 18, 2017Tutorial
How to integrate Google Analytics with Magento 2

Having a store, you should have an eye on how your sales are going and which are your top-selling products. Do you wish to see where your sales are coming? Which city? Is Twitter sharing causing your sale spike? Who comes to your store by searching on google? There are many analytics solutions in the market. You can always play with free solutions before moving to advanced analytics and data crunching systems.

An industry standard (Google Analytics) is the perfect solution for you. Google Analytics (GA) is a free service by Google that allows you to monitor website traffic and conversion ratio (i.e., completed activities that you measure as goals) in a few clicks. With Google Analytics, you can pay more attention to important ratios like sessions, traffic, region, tracking, and conversions.

Do you know that Google Analytics has built-in integration with Magento 2! It can provide in-depth insights about store traffic, visitor segmentation, e-commerce conversions, demographics visualization, and goal-related tracking. All these services can give a new dimension to your business. Capturing this data is just one part of the journey. Analysing and leveraging it for your business goals is also as critical as gathering it. To begin with, you need a Google Analytics account and Magento configuration to use this functionality. In this tutorial, we intend to guide you to integrate Google Analytics with Magento 2. For integration, you just need Account Tracking code.


How to get tracking code?

  1. You need to first Sign In to your Google Analytics account. If you don’t have one, just sign up for free and get started. Click here to Login / Sign Up
  2. Click the Admin on the top nav bar => Go to Account Settings
  3. Select and Copy the tracking number.



How to Integrate Google Analytics to Magento 2?

Magento 2 has a simple configuration for Google Analytics. It doesn’t require any script, all you need is the tracking number.

Go to Admin Panel => Stores => Configuration



Expand the Sales section in the left sidebar and click on Google API.



  • Enable: Select yes to enable Google Analytics for your store.
  • Account Number: Enter your account tracking number here.
  • Enable Content Experiments: If you have activities that you want your users to complete and metrics that you want to improve on your store (e.g., revenue, session duration, bounce rate). With Content Experiments, you can test which version of a landing page results in the greatest improvement in conversions (i.e., completed activities that you measure as goals) or metric value. To enable this feature set it to Yes.

You can also perform e-commerce tracking on Google Analytics.The e-commerce reports by Google Analytics helps you to analyze the purchase activity on your Magento 2 store.

How to Configure e-commerce Setting in Google Analytics?

To explore e-commerce setting in the admin area of your Google Analytics Accounts => E-commerce Settings.Ecommerce-Setup-in-Google-Analytics


After completing the setup, you will be able to check reports in the left sidebar.



Once you have configured Google Analytics correctly, you can control your store on autopilot mode and let analytics handle the store. You can update your store based on the reports provided.

Hope this tutorial helps you to configure Google Analytics with your Magento store. Thanks for reading. Do let us know if you have any queries or feedback. If you like the article, please feel free to share.

About Editorial Staff

We are a team of Magento ecommerce developers and SEO experts at Humcommerce. We write about anything and everything which can help you run your Magento 2 ecommerce store better.