Get 15% off Mageplaza extensions & subscriptions! Use code HIMAY at checkout.

Set up Google Analytics eCommerce tracking in Magento 2

Vinh Jacker | 02-18-2020

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

If you have a website, you should be using Google Analytics.

Google developed Google Analytics to help webmasters understand their website’s traffic and what visitors are looking for. So if you haven’t used Google Analytics yet, you are missing out on the opportunity to optimize your website’s performance and understand your prospects.

In case you’re hesitant to Google Analytics on your Magento 2 store, some tools make it easier to integrate this free data tracking service.

Let me tell you how Google Analytics is important to an eCommerce; website and how to add the Google Analytics eCommerce tracking feature to your Magento 2 site.

Table of Contents

Why should you use Google Analytics for eCommerce?

Google Analytics is a free web analytics service by Google that offers you real-time statistics and insightful data analytical about your website’s traffic.

Google Analytics will tell you how many people visit your store, where they’re coming from, their devices, how long they stay on your website, and much more. Briefly, it provides your website’s user behavior that can be critical for your business success strategy.

In detail, you can see how people find your website through the Google Analytics report. It finds out how many visitors to your website after clicking on a link from the search result. How many people land on your site from links on social media, other websites, or directly searching for you by typing your website name on the search?

You also can know what people are browsing for on your website, which pages they’re visiting the most, and even who they are. Google Analytics provides you with your visitors’ information in terms of demographics, geography, and general interests.

Google Analytics is easy to use even if you’re not tech-savvy. Why don’t you use Google Analytics to get all the critical data that helps your business?

If you haven’t used Google Analytics in the past, get started by creating a Google Analytics account. Keep reading to learn how to add Google Analytics eCommerce tracking in your Magento 2 store.

Google Analytics

Google Analytics PRO for Magento 2

A clear insight into shopping and behavior of customers with 5 advanced reports

Check it out!

How to configure Google Analytics eCommerce tracking in Magento 2?

Step 1: Get Google Analytics Tracking ID

Login to your Google Analytics account. Create a Google Analytics account here if you haven’t had one.

Google Analytics account

Fill in your information and website address, then check the checkboxes to accept the Terms of Service Agreement.

After signing in, go to Admin, you’ll see your Google Analytics Tracking ID. It’s also your Google Analytics tracking code that you need to add to your website to collect data on your website’s behavior. Copy the Google Analytics code for the later setup.

Step 2: Configure Google Analytics in Magento 2

At the admin panel, go to Stores > Configuration.

Google Analytics configuration

In the dropdown of the SALES section, select the Google API option.

Google API

Next, select Yes to enable Google API. Paste the Google Analytics tracking code you get in the Account Number field, then click on Save Config to complete the configuration.

save configuration

Step 3: Set up eCommerce tracking in Magento 2

You can use Google Analytics at its best through eCommerce reports. It analyzes the purchase activity on your Magento 2 store and provides a fantastic amount of insight to optimize your online selling.

In the eCommerce overview report, you can see site-wide statistics on orders and revenue, including some high-level metrics:

  • Ecommerce conversion rate: the percentage of site visits

  • Transactions: the number of purchases on your site

  • Total revenue: total amount spent by customers on your site

  • Average order value: the average amount of revenue by each order

  • Unique purchases: number of times when one product or a group of products is in a transaction.

  • Quantity

And much more data.

It takes a few clicks to set up eCommerce tracking on your Magento 2 ecommerce store.

First, log in to your Google Analytics account. In the Admin area, click on the Ecommerce settings tab.

eCommerce setting

Now, enable E-commerce and enhanced eCommerce reporting and click on the Save button.

eCommerce tracking

Lastly, you would be the best if you verified that Google Analytics eCommerce tracking works appropriately on your Magento site. It takes a few minutes for the data to load in your Google Analytics property and get ready to show up in your GA real-time report.


Google Analytics enhanced eCommerce tracking provides robust metrics that help your company market better and be more profitable.

Mageplaza Google Analytics extension offers useful integration to add Google Analytics to your Magento website and turn on eCommerce tracking quickly.

I believe this tutorial will be helpful for you to configure the best feature of Google Analytics on your Magento store. If you have any questions, leave your words in the comment section below.

Visit Mageplaza Google Analytics

Related Posts:


Hello, I'm the Chief Technology Officer of Mageplaza, and I am thrilled to share my story with you. My deep love and passion for technology have fueled my journey as a professional coder and an ultra-marathon runner. Over the past decade, I have accumulated extensive experience and honed my expertise in PHP development.

Related Post

Website Support & Maintenance Services

mageplaza services

Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.