Making decisions based on suggestions is not the best way to do business, especially in eCommerce. Correspondingly, if you don't know what your customers like and pay attention to, your hands are tied. 

Google Analytics is one of the most powerful website analytics tools that help you gather behavioral data about your store visitors and act upon it. 

When you have information about the source people come from,  what products most of the traffic goes to and how much time users spend there, you can change your website for the better accordingly. 

Besides, it is just a small part of the data Google Analytics provides you with, there is much more if you delve deep into the options.

Here, we'll help you add Google Analytics in Magento 2 in a few easy steps so you can improve your customer experience level.

Should we start?

Create Google Analytics Account:

1. Log in to your Gmail account and go the Google Analytics to create the GA account. 

Set Up Google Analytics in Magento 2

2. Specify the Account Name and select the Account Data Sharing Settings.

Google Analytics Account Setup

3. Set up a Property to measure your website data. 

  • Enter the Property name.
  • Choose the Reporting time zone.
  • Select Currency.

Google Analytics Property Set Up

4. Go to the advanced options to set the Website URL and choose whether to create a Universal Analytics property only or the Google Analytics 4 and Universal Analytics together.

Note: at the time of writing this article, Magento v.2.4.3 doesn't support GA4, so if you don't want to use any third-party integration, you'd better go with Universal Analytics.

Crate Universal Analytics Account

5. Provide your Business information. GA asks for your Industry category, Business size, and the Purpose you want to use your Google Analytics for. It helps this tool to tailor your experience.

GA Business Information

6. Accept Google Analytics Terms of Service to continue.

Google Analytics Terms of Service

7. Get your Tracking ID you can use in your application to gather data about customers' behavior.

Universal Analytics Tracking ID

Add Google Analytics to Magento 2

Navigate to your Magento 2 admin panel > Stores > Configuration > Sales > Google API  and configure Google Analytics.

  • Enable Google Analytics in Magento.
  • Specify the Account Number that corresponds to the Tracking ID from your GA account. (find it under the Property Settings tab)
  • Choose whether you want to Anonymize IP. We recommend always enabling this option to secure your customers' IPs.
  • Enable Content Experiments if you want to conduct the A/B testing or other performance tests.

Add Google Analytics in Magento

Don't forget to Save Config once you finish and check if everything works correctly.

You can use the Tag Assistant Legacy Chrome extension and see whether GA is implemented correctly.

GA Tag Assistand Extension

Seems like that's it?

Unfortunately, adding Universal Analytics code to Magento is not enough to get all of the insights you could possibly get. It can benefit you even more if you use GA4 along with the Google Tag Manager. 

So, the next step would be to add Google Tag Manager to Magento 2 and connect it with GA4 with the help of the best Magento 2 Google Tag Manager Extensions

They help you to take it one step further and track promotion impressions, coupons, user ID, review count&score and even sale products. Check them out to make sure they're worth it.