Seamless Way To Add Google Analytics 4 (GA4) With Magento 2

Hiren Raval

Head of eCommerce and ERP

Google’s announcement that it would let go of the widely used and beloved Google Analytics Universal Analytics solution shocked the eCommerce industry recently. 

Integrate Google Analytics 4 With Magento 2

Normal Universal Analytics properties will stop collecting data on July 1, 2023, which is a big deal for the eCommerce industry. This is so because the difference between not having and having appropriate data directly impacts sales.

With Google Analytics, you’ll be able to collect data that will allow you to make informed business decisions that will help you grow your company.

Bounce rates, page views, traffic sources, session times, search terms, and more can all be tracked with just a basic implementation of Google Analytics.

In addition, there is real-time tracking that allows you to see the number of visitors currently on your website, where they belong, and what they are currently browsing, so you’re always aware of how your website is performing at any given moment.

If you’re running an eCommerce store, you’ll be able to take your Google Analytics tracking to a new level with Enhanced eCommerce Reporting,

which unlocks additional metrics such as Product List Views and Conversion Rate in addition to the basics. 

Google Analytics 4

Enhanced eCommerce Reporting is a helpful tool, but only when used wisely and appropriately for your business professionals can assist you in using them.

Another helpful feature is running A/B tests to see what content performs best for your audience. Although Google has eliminated the decision to enable content tests, Google Optimize, which has a similar feature set, has been introduced in its place.

Magento developers at Brainvire have the right amount of Magento and Google Analytics knowledge required for your company.

Universal Analytics is a fantastic and essential tool for any website, so why is it being discontinued? Simply put, it’s getting a revamp! Google Analytics 4 is taking over for Universal Analytics (GA4).

This can be challenging, but before you take any initiative for Magento development or Google analytics code, it is essential to seek an expert’s opinion.

Brainvire’s Magento developers have shared a few insights that can offer you a seamless journey:

Understanding Google Analytics 4 (GA4)

An entirely new kind of privacy-first Property, their new-age measurement solution is Google Analytics 4. It shapes previous Universal Analytics belongings in a way that is both privacy-conscious and forward-looking. 

Machine learning does use to enhance insights into the user journey across different devices and platforms, where extensive and deep integrations with Google’s advertising platforms.

For example, Google Analytics 4 can automatically alert and make you aware of prominent trends in your Magento website data, such as a specific product category growing in sales due to accelerated demand, allowing you to make data-driven decisions that will benefit your business. 

This is possible because of Google’s advanced machine learning algorithms. But, even more importantly, Google Analytics 4 can fill in data gaps caused due to:

  • Cookie consent rules
  • Software blocking tracking scripts
  • Other privacy-specific settings

This ensures that your accumulated data is comparatively more relevant. This is due to the enhanced capabilities of machine learning.

In the advanced Google Analytics 4 platform, traffic and data from both the Web and mobile apps are centralized, based on the App property + Web that Google beta-tested in 2019. 

History of Google Analytics
Image Source: MeasureSchool

You don’t have to segregate your data across two platforms (Google Analytics for basic web traffic and Google Analytics for Firebase in the case of mobile apps) because Google Analytics 4 offers a single view of dual data streams.

Is Google Analytics 4 An Appropriate Choice For Your Business?

To run a successful online business, regardless of the size of the company or the type of website that you have, is critical to ensuring the success of your business, especially given the fact that more and more businesses are turning to the internet, resulting in a greater level of competition.

To start collecting the data Google Analytics needs for its artificial intelligence; you must set up Google Analytics.

Key Reasons For You To Make The Move

If you are an existing Universal Analytics user, you might be clueless why you should bother making the switch to a Google Analytics 4 property before it’s retired in 2023. 

However, this does not necessitate the shutdown of your existing Universal Analytics property; instead, you can continue to run them side by side.

How To Obtain Magento Analytics And Support For Google Analytics?

We Are Here!

The following are the fundamental reasons to set up a Google Analytics 4 property at the earliest:

  • Using Google’s advanced machine learning models will confirm that the collected data is appropriate.
  • Additionally, it can help you foresee business opportunities before your competitors, allowing you to take advantage of them before they can act.
  • You’ll begin collecting historical data, allowing you to make data-driven business decisions in the future
  • while your competitors are still squandering time collecting historical information on multiple platforms.
  • You can dedicate significant effort hours so that AI can understand your business functionalities as soon as you get started. This means that the smarter it will be, the sooner you can begin!
  • A wide and descriptive database can provide you with more accurate information, and it will be easier to make assumptions based on this data.
Comparison between Universal Analytics and Google Analytics 4
Image Source: Ryte

It’s evident that implementing a solution like Google Analytics 4 and adapting and learning your business is critical, and it’s best to do it the earliest!

How To Integrate Your Personalized Magento Store With Google Analytics 4?

It’s easy to set up basic tracking in Google Analytics 4 for an online eCommerce store. However, hire magento developer for Magento development would be wise as they can make your process convenient.

Let’s take a look at all the configuration steps and settings needed to get standard Google Analytics tracing up and running on your Magento 2 website:

Setting Up Your GA Property

Creating and setting up a new Google Analytics 4 property is the first step in the configuration process; here’s how you can do that:

  • Step:1 Insert Google Analytics dashboard credentials with your Google Analytics account or Gmail account. Google Analytics account is usually the preferred choice. Your next step is to find the Account settings option in the settings section.
  • Step:2 Click on the Create Property option available under the Property. Enter your Reporting Time Zone, Property Name, and Currency, and click on the Next button to create your default Google Analytics 4 property.
  • Step:3 You have the option of providing Google with information about your business so that they can personalize your experience. Click on Create after you’ve made your selections.
How to Create property in Google Analytics
Image Source: Google Support

Streamline Your Data Sources And Obtain Your Measurement ID

Once you have set up the Property, you can acquire the Global site tag for your Magento store.

  • Step: 1 Your next initiative should be to create a specific stream for data that showcases the channel from where the data is accumulated. As Magento web development services, we recommend you set up a track channel for your online store. Go to a tab named Choose A Platform tab and select the web option.
  • Step:2 A new window will pop up where Magento development services like us can help you to set up your data stream further to obtain your Measurement ID. Insert your website URL to select a specific stream name. The Enhanced Measurement tab offers you insights and basic tracking during the implementation. The settings cog has additional event details and disables the unwanted information.
  • Step:3 When you click on the create option, new window pop-ups with Web Stream Details. On this window, you can check your Measurement ID, further tagging instructions, and insert your Tracking ID with your store. 
  • Step:4 Your next step is to open a specific Tagging Instructions tab, click on the Add new On-Page Tag option and insert the appropriate Global Site Tag. Then, Magento development services can share the required information.

How To Set Up Global Site Tag In Your Magento 2 Store?

In our Magento Admin section, we can add the Global Site Tag in Google Analytics 4 on the website now that we have it.

Feed in your Magento Admin credentials and move to the Content section, Design, and the configuration section.

Visit the Google Analytics Code section, select the choice of your Magento 2 store-view and finally click on the edit option.

Next, insert your Google Analytics Code in the extended HTML head section available in the Scripts and Stylesheet option. If you are clueless about Google Analytics Code, don’t hesitate to hire an expert. They can share appropriate Google Analytics Code suitable for your business.

Save this setting and move to the Cache Management section available on Admin in Magento 2. Then, you can click on System to navigate the available Tools and Cache Management.

The next step is to click the Flush Magento Cache option to reload your Magento store’s front end.

How To Set Up Global Site Tag In Your Magento 2 Store
Image Source: Google Support

Analyzing The Source Code

Examine the source code of a page in your business to determine if it is properly tagged with the Google Analytics 4 code.

You can do this by right-clicking one page on the storefront and selecting View Page Source.

You should see the Tracking ID (Global Site Tag) that can be added to the Magento Admin in the Scripts and Stylesheets section.

To see the Tracking ID, you’ll need to clear the store’s cache or use a CDN (like Cloudflare), in which case you’ll need to remove the cache as well.

It is important to test and analyze your codes for smooth integration.

Navigation of Google Analytics Universal and Google Analytics 4
Image Source: Softcrylic


In addition to these options and Adobe Commerce, there are diverse techniques available for tagging and confirming your Magento store. Moreover, it’s essential to have support for Google Analytics and Magento analytics to access real-time data. Recognized as an Adobe partner, Brainvire can significantly simplify your journey.


What is Google Analytics 4 and why is it important for website owners?

Google Analytics 4 is the latest version of Google’s web analytics tool. It is important for website owners because it offers a more complete picture of user behavior across devices and platforms, and provides more advanced machine learning capabilities for predicting user actions and segmenting audiences.

What is Magento 2 and how does it relate to Google Analytics 4?

Magento 2 is an open-source e-commerce platform for building online stores. It relates to Google Analytics 4 because it is a common platform used by online retailers, and integrating Google Analytics 4 with Magento 2 can provide valuable insights into user behavior and e-commerce performance.

What are some benefits of using Google Analytics 4 with Magento 2?

Some benefits of using Google Analytics 4 with Magento 2 include:

– Enhanced tracking of user behavior across devices and platforms
– Improved attribution modeling for measuring the impact of marketing campaigns
– Advanced machine learning capabilities for predicting user actions and segmenting audiences
– More powerful data analysis and visualization tools for understanding user behavior and optimizing e-commerce performance

What are the steps involved in adding Google Analytics 4 to Magento 2?

The steps involved in adding Google Analytics 4 to Magento 2 are as follows:

– Creating a Google Analytics 4 property and obtaining a measurement ID
– Installing the Google Analytics 4 tracking code on the Magento 2 website
– Configuring the tracking code to capture relevant e-commerce events, such as purchases and product views
– Testing the tracking code to ensure it is working correctly

Can Google Analytics 4 be integrated with other e-commerce platforms besides Magento 2?

Yes, Google Analytics 4 can be integrated with other e-commerce platforms besides Magento 2, such as Shopify, WooCommerce, and BigCommerce.

What are some best practices for using Google Analytics 4 with Magento 2?

Some of the best practices for using Google Analytics 4 with Magento 2 include:

– Setting up enhanced eCommerce tracking to capture detailed data on user behavior and transactions
– Creating custom dimensions and metrics to track specific aspects of user behavior, such as product categories or user segments
– Using Google Analytics 4’s machine learning capabilities to identify patterns in user behavior and optimize eCommerce performance
– Creating custom reports and dashboards to visualize key performance indicators and track progress over time
– Continuously monitoring and analyzing data to identify opportunities for improving user experience and increasing revenue.

About Hiren Raval

Hiren is a seasoned eCommerce consultant who has helped many businesses succeed. He’s worked with companies of all sizes to help them find the right solutions and strategies to grow their business. If you need someone who can guide your company through this new landscape, Hiren is the person for you. Get in touch with him today!

Lets Connect!