Setup Magento 2 Google Analytics: 3-Step Quick Guide

Magento 2 Google analytics-min
Last updated Nov 10, 2020

These days, only adding and selling products from your Magento website is not enough. Understanding the traffic, sessions, tracking, conversions, etc is an important aspect to scale your online business. This article will help you configure Magento 2 in Google Analytics.

Google Analytics (GA) is a free service provided by Google to help you with the information on critical metrics like the number of visitors, time spent, demographics, and more. All this information can give a fully new dimension to your business.

How to Configure Magento 2 in Google Analytics?

In this step-by-step guide, you will learn how to enable Google Analytics in Magento 2. 

 1. Create a Google Analytics Account

 2. Obtain a Tracking ID

 3. Configure the Google API in Magento 2

4. Bonus: Enable eCommerce Tracking

Step #1 – Creating an Analytics account

To get started with google analytics you need to have an Analytics account,  for that 

  • Visit the Google analytics official site
  • Sign in through your Gmail account 
  • If you don’t have one, you can create an ID.
Magento 2 Google Analytics sign up

Step #2 –  Obtain a Tracking ID

    In this step, go to:

  • Admin tab (on bottom left corner)
  • Click on Tracking info
  • Get your Tracking ID from there
  • Copy the code for pasting in Magento
Magento 2 Google Analytics - code

Step #3 – Configure the Google API in Magento 2

In this last step

  • Log in to your “Magento Admin Panel”
  • Got to “Stores” and click “Configuration”
  • Choose “Sales” and find Google API option
  • Paste it on Account number field and click “Save Config”
Magento 2 Google Analytics - api

Bonus Tip: Enabling eCommerce Tracking

Many store owners do these simple things wrong:

  • Don’t forget the essential step of enabling eCommerce tracking
  • Make sure to turn it on under the eCommerce setting button
Magento 2 Google Analytics - enable ecommerce settings

To set it up, go to the Admin of your Google Analytics account > Ecommerce Settings.

Once you save this setting, you will be able to analyze the purchase activity on Magento 2 store. This will provide information regarding product/transaction details, purchase time, average order value, and more.

To verify your setup of Magento 2 Google Analytics is working properly, you need to launch your store and wait for a couple of minutes. If you see traffic data like the below image, it means your GA is configured properly.

Magento 2 Google Analytics - real time users

And boom, you’ve successfully added Google Analytics to your Magento 2 store.

Why Is Google Analytics Not Working Properly?

If you don’t see any active users, these could be the reasons:

1. Wrong Analytics Code

If you copy-pasted the code from a doc file, there are chances you might break the code. Always copy-paste the code directly from Google Analytics account. There shouldn’t be any extra space.

2. Google Penalties

With running an eCommerce site, comes great responsibilities. You have to check if you’re using SSL on your website. Google can penalize your site for not having a secure connection.

3. Check for Google Analytics Filters

Go to the Admin > Filters.

There are chances that you have excluded your IP address tracking which is why you aren’t seeing any real-time users from your IP.


You may face some issue in tracking if you’re using an older version of Magento. You can simply upgrade it to the latest version to continue with GA.

Webscoot provides the best eCommerce hosting for growing businesses. Looking for a managed hosting solution? Contact our experts.



Submit a Comment

Your email address will not be published. Required fields are marked *

Magento Security eBook

Learn How To Hack-Proof Your Magento Store

This Ebook Is Going To Help You With Your Magento's Security, Secure Your Magento For Better SEO & More Revenue.

Thanks For Downloading Ebook