How to Connect Google Analytics 4 With Your Magento Store

5 Min | May 23, 2023

Google Analytics 4 is the newest iteration of Google’s web analytics product. It is a powerful analytical tool that gives you insights about web performance, customer engagement and most importantly your sales.

Recently Google Analytics 4 will replace Universal Analytics. Over the years, the internet has evolved into a multi-functional world of touchpoints. Customers rarely interact with a single medium of sale. Gone are the days when people bought only from a website.

Google Analytics 4 unifies the web and mobile application analysis as your customers play with multiple platforms throughout their journey.

Why Google Analytics 4?

Google Analytics 4 measures every single detail regarding your buyers and their behavior. It has the capability of tracking and analyzing different aspects about your website and gives a detailed report on audience analysis and behavior, which includes engagement rates, conversion rates, real-time monitoring of visitors and their geographic locations, customized integration with Google Ads to analyze performance of paid campaigns as well. In short, it gives the tracking details about your visitors from acquiring to retaining them to your website.

It’s time to move to Google Analytics 4 as you will need this tool to understand the performance of your Magento store.

Step-by-Step Guide To Connect GA 4 With Magento Store

The aim of this post is to explain how you can connect your new Google Analytics 4 account to your new Magento store. If you are already using Universal Analytics (pre-GA4 version)  with your existing Magento store, we recommend that you follow the setup wizard by Google for converting your Universal Analytics to GA 4.

To set up GA 4 on your Magento store, you will have to complete two-steps

  1. Integrating Google Tag with Magento
  2. Integrating Measurement ID with Magento

For starters, you have to create an account and the relevant Data Streams on Google Analytics. You will then receive a Google Tag code for your first step and after integrating the code, it will finally give you a Measurement ID for the second step. This is the complete holistic approach for implementing GA 4.

Setting up a Google Analytics 4 Account

First thing first, visit analytics.google.com and sign into your Google Account.

google analytics 4 magento

Hover to the left panel, and click on the ‘Admin’ tab and then click on the blue colored ‘Create Account’ button. It will open a form for you to fill out.

google analytics 4 magento

On next screen, it will see 3 sections related to:

  • Account Setup
  • Property Setup
  • About Your Business

Account Name

Write the Account Name and proceed with the NEXT button.

google analytics 4 magento

Property Setup

Write Property Name as per your choice and click the NEXT button.

google analytics 4 magento

About your Business

Pick Industry from the options available, Company size and the parameters you want to use GA 4 for. After detailing, tap the CREATE button.

google analytics 4 magento

Checkmark the Data Processing Terms field. Then, proceed with the I ACCEPT button.

google analytics 4 magento

STEP 01: Connecting Google Tag With Magento

Once done with Account settings, it will take you to the dashboard and will ask about START COLLECTING DATA. Pick the platform you are going to use, WEB is recommended for the better results.

google analytics 4 magento

Next, write the Data Stream details about your website, from where GA4 will fetch the information. Note: Copy the website URL without HTTP/HTTPS and a backslash. Then click the CREATE STREAM button.

google analytics 4 magento

It will automatically give you ‘Google Tag Code’ to add on to your Magento Admin Panel. Simply copy the code by clicking on the small copy icon located in the top right corner of it.  The code will be copied to the clipboard.

google analytics 4 magento

Now open the Magento Admin panel in a new tab, and enter the credentials to sign in.

google analytics 4 magento

Move to the left navigation panel, Click Content > Configuration and Click the Edit button on the website link you to track with GA4.

google analytics 4 magento

Scroll down to the HTML Head And click the drop-down icon. Paste the code from the clipboard in the Scripts and Style Sheets section box and hit the Save Configuration button placed on the right top corner. For the convenience you can reference the screenshot below.  Once done with saving it will prompt a message on top regarding the changes that you just made.

google analytics 4 magento

Now again go to the left Navigation Bar, click System > Cache Management
Select all and hit the Submit button.

google analytics 4 magento

STEP 02: Integrating Measurement ID With Magento

Coming back to Google Analytics, close the installation instruction. Under the Admin tab, you will find the Data Stream section, click on it. Open the Data stream details of your website by clicking on it.

google analytics 4 magento

Click on the Copy icon to note the Measurement ID and you will need to paste it on Magento Admin.

google analytics 4 magento

Move back to your Magento Admin and navigate to Stores > Configuration.

From the Configurations, move to Sales > Google API appearing on the left side.

Your screen will prompt you with Google Analytics, Google AdWords and Google Gtag.

Go to the Google tag, It contains the Google Analytics4 detail.

  • Select ‘Yes’ from the Enable dropdown.
  • Paste the ‘Measurement ID’ in the required field.
  • Press the ‘Save Config’ button.

google analytics 4 magento

That is it! Have a look at your Google Analytics dashboard and it would’ve started to record your data from your website.

google analytics 4 magento

Conclusion

This is the default method of implementing Google Analytics on Magento Ecommerce. Leveraging the power of GA4 will enable you to gain deep insights into user behavior, optimize marketing efforts, and enhance user experiences. Stay ahead of the competition by harnessing the full potential of GA4 on your Magento store and make data-driven decisions that drive your eCommerce business to new heights. And if you want to enhance your store analytics game, we suggest connecting Microsoft Clarity with your Magento store as well.

The Author

Scroll to Top