Setup Google Analytics in Magento 2

How to Add Google Analytics in Magento 2?

In today’s tutorial, we will guide you with a step by step process to set up Google Analytics Tracking in Magento 2. Google offers a free service that lets you track and monitor the traffic and conversion rate in a few clicks named Google Analytics. It helps an eCommerce store owner with the facility to monitor and keep a complete track of the traffic on Magento 2 Store.

This will help you with better management of products in the store and ultimately gain more customers. The traffic on an eCommerce is one of the biggest factors behind the success of a store.

Here are the steps on How to Add Google Analytics in Magento 2.

  1. Set up a Google Analytics Account.
  2. Set up a Property in Google Analytics.
  3. Add Google Analytics code to Magento 2.
  4. Enable eCommerce Tracking for Google Analytics.

Let’s learn each step in depth for correct to Add Google Analytics in Magento 2 correctly.

Step 1: Set up a Google Analytics Account

First of all, login into your Gmail account and search Google Analytics. Now, click on Analytics on the top right corner of the page.   Setup Google Analytics

Just click on Sign Up

Analytics

Now, enter the details of your Magento 2 Store (Account Name, Website Name and Website URL). Now Click on Get Tracking ID.

Traking id

Read the Google Analytics Terms of Service Agreement and Click on I Accept.

Google Analytics Terms Conditions

Step 2: Set up a Property in Google Analytics

Creating a property in Google Analytics is the first thing you need to do for each website that you are looking to collect data for. Once done, your Google Analytics ID will be generated to help you setup later. Follow the instructions from Google.

Google Analytics Property

You will be redirected to the Tracking ID Page. Copy the Tracking ID that you need to use in the configuration step.

Analytics Tracking Code

 

Step 3: Add Google Analytics code to Magento 2

Log in to the Admin panel and navigate to Store → Configuration

Store Configure

Scroll down and click on Google API in the Sales tab.

Google Api

 

Unfold the Google Analytics and Select YES from the Enable drop-down, enter the Tracking ID in the Account Number text field and Select YES from Enable Content Experiments drop-down menu.

Now Click Save Config.

Save Confige

Step 4: Enable eCommerce Tracking for Google Analytics

In order to enable eCommerce Tracking, click on eCommerce Settings from the Admin area of Google Analytics.

ecommerce tracking analytics

Enable eCommerce and Enhanced eCommerce Reporting and click on Submit.

 

enhanced ecommerce settings

And you are done! Visit your store and go to your Google Analytics.

You’ll find the traffic activity on your Magento 2 store.

As per the announcement, from July 1, 2023, standard Universal Analytics (UA)  properties will stop processing new hits with the introduction of all-new Google Analytics 4 (GA4).

So here is the guide on new GA4 that you can follow to configure GA4 with GTM in Magento 2 Store.

Also, Refer this Magento 2 Google Analytics 4 (GA4) With GTM Support Extension’s FAQ Page for most common questions and it’s answers.

Hope this tutorial helped you with the setting up of Google Analytics on your eCommerce store. If we missed out on anything, feel free to reach us out.

Tags