How to move from Google Analytics 3 to GA4

Google has launched a countdown for a data collecting service you use in your Magento 2 store. Google Analytics 3, also known as Universal Analytics, will stop working after July 1, 2023.

Now it is time to move to the modern Google Analytics 4 (GA4). You can leave the transition to Google, as it promises to use your current analytics configuration to do the migration automatically after the deadline. But it may be more robust to make this migration from Google Analytics 3 (GA3) to GA4 manually. Here is a step by step guide on how to do it.

  1. Differences Between GA3 and GA4
  2. Key benefits of upgrading to GA4
  3. Moving Magento from Google Analytics 3 to Google Analytics 4
  4. Using GA4 Reporting and Features
  5. Tips and Best Practices for GA4
  6. Summary

Differences Between GA3 and GA4

Google Analytics 4 (GA4) is an updated version of Google's analytics service that has been undergoing public testing since 2020. It represents a significant upgrade from the Google Universal Analytics (GA3).

The primary distinction between GA3 and GA4 is the shift from session-based tracking to event-based tracking. This transition enables the collection of standardized data across various platforms, resulting in a comprehensive report that cover the entire user journey in the sales funnel.

In addition to the transition to event-based tracking, GA4 introduces machine learning and Natural Language Processing (NLP) capabilities. These features enable businesses to predict conversion probabilities and leverage the insights for their Google Ads campaigns. Machine learning algorithms can also detect anomalies in reports, such as missing conversion tracking or inaccurately calculated conversion coefficients.

By embracing Google Analytics 4, online stores gain access to advanced analytics functionalities that provide valuable predictive insights and automated anomaly detection. This empowers businesses to make data-driven decisions, optimize their advertising campaigns, and ensure accurate measurement of their conversion metrics.

Differences in features and data model between GA3 and GA4

Google Analytics 3 (GA3) and Google Analytics 4 (GA4) differ significantly in terms of features and data models.

Data Model

GA3 follows a session-based data model, where user interactions are organized into sessions, pages, and events. Each session represents a visit to the website, and multiple interactions within a session are grouped together. GA3 requires manual tagging and customization for capturing specific user interactions.

GA4 introduces an event-based data model with every user interaction being treated as an event. This event-centric approach provides more flexibility and granularity in tracking user actions, allowing businesses to capture more of user behavior. GA4 simplifies event tracking implementation and provides a wider range of out-of-the-box events to track, eliminating the need for extensive manual tagging.

Every event in GA4 has the capacity to accommodate up to 25 personalized parameters. For instance, a page view is tracked as an event, and it can be enriched with event parameters such as the page language, screen resolution, and page referrer to get better details on customer behavior.

User-Centric Measurement

Since GA3 is primarily session-centric, it tracks user behavior within individual sessions. It lacks the view of user interactions across multiple sessions or devices.

GA4 uses a unique User ID for tracking the user behavior across devices and platforms.

Machine Learning and Predictive Analytics

GA3 mainly relies on manual data analysis and interpretation by users.

GA4 is capable to provide automated insights, anomaly detection, and predictive metrics with the help of integrated machine learning algorithms. GA4 leverages predictive analytics to deliver valuable insights, identify trends, and predict user behavior, empowering businesses to make data-driven decisions.

Cross-Platform Tracking

GA3 has limited capabilities for tracking user interactions across different platforms and devices. Business owners have to execute additional customizations to achieve comprehensive cross-platform tracking.

GA4 offers cross-platform tracking out of the box. It can track user interactions across websites, mobile apps, and other digital platforms, providing a unified view of user behavior across devices.

Key benefits of upgrading to GA4

GA4 represents a comprehensive revamp of the user tracking methodology, merging user behavior monitoring across web and app platforms. This solution introduces fresh tracking functionalities catering to the needs of businesses.

One of the main benefits of GA4 over GA3 is engagement tracking. Google Analytics 4 is capable to show the user engagement with the content during his viewing session.

The Google Analytics 4, for example, can track the following user behavior:

  • lands on home page
  • scrolls down the page
  • launches a video
  • video viewing progress
  • navigates to next page
  • leaves the website

Additionally, the Engagement rate and Time of involvement, are now traceable on smartphones, which previously was not possible with Universal Analytics.

Overall, upgrading to GA4 provides the following key benefits:

  • more powerful conversion funnel analysis
  • cross-domain and multiplatform tracking of user behavior
  • free of charge BigQuery integration
  • more accurate credits for conversion sources (GA3 simply attributed conversion to the last source a user came from)
  • predictions on customers (purchase probability, churn probability, predicted revenue)

Moving Magento from Google Analytics 3 to Google Analytics 4

You can migrate your GA3 to GA4 while keeping the existing analytics JS code snippet in the Magento store frontend. Keep in mind that you will have no option to migrate your existing tag customizations.

Step 1. Upgrade your GA3 analytics property to GA4

In your GA3 open the analytics property you want to migrate to GA4. When it will be loaded in your browser, navigate to the Admin section. Locate the GA3 property column and click GA4 Setup Assistant.

You will be transferred to the Google Analytics 4 Property Setup Assistant page. Scroll this page down.

Locate the section I want to create a new Google Analytics 4 property and click the Get Started button.

Activate the Enable data collection using existing analytics.js and gtag.js tags option to continue using the analytics JS code snippet that is already present in your Magento store frontend.

Click the Create property button. You will be informed with a pop-up window about the successful creation of the GA4 property.

Additionally, if you have chosen to use the existing JS code snippet, the GA4 property will change its status from Not connected to Connected.

You can click Go to your GA4 property to open the newly created analytics object.

As of now, you have two properties: one for GA3, and the other for GA4.

Your connected Universal Analytics property remains unchanged.

Step 2. Verify the GA4 property works

Typically, it may take up to 24 hours for the data to appear in your Analytics account.

However, in case the GA4 property was configured correctly, and you opted to use the existing Google Analytics JS code snipped, you may immediately see the user realtime tracking data in your GA4 property.

Navigate to Reports > Realtime to see the user statistics collected in for the last 30 minutes.

Additionally, in your GA4 property you may navigate to Admin > Property > Events to view the report on gathered events and page viewing statistics.

Step 3. Configure GA4 data streams

To get the most of the Google Analytics 4 capabilities, it is required to configure data streams by connecting a tag to your Magento store.

Scroll down the column of the GA4 property options.

Locate the Data Streams option. Click on your web data stream.

A new window with the options for your web data stream will open. Scroll it down to the Google tag section.

Add Google Tag to your store frontend

Copy the Google Tag Code

Click View tag instructions and copy the Google Tag Javascript code snippet.

Paste this code snippet in your Magento store frontend.

Insert the Google Tag in the Magento frontend

Return to your Magento store admin panel and navigate to Content > Design > Configuration. Click Edit in the row of the Default Store View of your Magento theme.

Scroll to the HTML Head > Scripts and Style Sheets and paste here your Google Tag code snippet.

Note: To get full analytics features, including multiple tag management, you need to install and manage tags using a Google Tag Manager web service. See a step by step guide in the article How to setup Google Tag Manager in Magento 2 store.

Click the Configure tag settings.

Set the parameters of your tag. For example:

  • Automatic event detection. Specifies which types of events your Google tag will be detected automatically
  • Configure domains. Specify all domains that are serviced by this tag. Use this option for cross-domain measurement.
  • Collect Universal Analytics events. Check the option for allowing the tag to collect a call from Universal Analytics that occured on your website
  • Define internal traffic. Set the rules for the traffic to be considered internal.
  • List unwanted referrals. Set the list of domains that should not be discarded as referrals.
  • Adjust session timeout. Define how long a user session can last.
  • Override cookie settings. Specify the timeframe for the cookies to be considered valid.

Wait 24-48 hours before analytics will start displaying the collected data. In the Data streams section you will see the green mark Confirmation Data collection is active in the past 48 hours.

Migrate custom dimensions, metrics, and events to GA4

Since there are disparities between the data models of GA4 and Universal Analytics, your data in GA4 will have distinct differences when compared to your Universal Analytics data. For example, GA4 properties employ custom event parameters and user properties instead of the custom dimensions and metrics used in Universal Analytics.

The GA4 provides a list of preconfigured collects automatically-collected and enhanced measurement events, and there is no need to create it manually. To migrate an event from UA to GA4 you first need to see whether the UA event has a GA4 matching event for automatically collected event and enhanced measurement event.

For your custom UA events see the list of matching GA4 recommended events. Next, see the guide on how to create custom events and metrics in your GA4 property.

Note: An analytics property can have up to 50 custom dimensions and 50 custom metrics. There is also a limit of 25 custom parameters per event with each parameter value up to 100 characters long.

Using GA4 Reporting and Features

The data received by Google Analytics becomes immediately visible in the Realtime report. It subsequently appears in other reports shortly afterward.

The information included in your reports is gathered from your websites and apps once you have set up Google Analytics 4. However, certain data to be properly collected and displayed in the reports might require additional configuration.

Realtime report

The Realtime report monitors the activity on your website or app in real-time. The data is presented for a lifespan of the last 30 minutes, and it provides a visual representation of user behavior within the conversion funnel.

Use the cards of the Realtime report to get the following insights happening in your Magento store in realtime:

  • Overview of user engagement. See the number of users active on your web site or an app.
  • Information on acquisition channels. See users by Source, Medium, or Campaign from which your users are arriving.
  • Understand the user segmentation. See your users by audience to get better understanding of the characteristics of your visitors, including their demographics or other audience segments.
  • The content users engage in your store. See what specific content is interesting for your visitors, obtaining the insights on popular pages of your web site or screens of the app.
  • Identify what interactions visitors have with your Magento store.
  • See the completed conversions and event that lead to such outcome.

The Realtime report focuses on user-scoped dimensions and metrics. This means that the dimensions and metrics provided in the Realtime report pertain to how you initially acquire users, helping you understand their behavior from the moment they enter your website or app.

Reports snapshot report

The Reports snapshot serves as the default overview report for the Analytics. It provides a summary of key insights and data with the flexibility of customizing it by selecting any desired overview report to be displayed.

To construct an overview report, all you need to do is to combine summary cards derived from detailed reports. Furthermore, you have the flexibility to designate any overview report as the Reports snapshot. It will be assigned as the default report displayed when accessing the Reports section in Analytics.

Keep in mind that each property allows for a maximum of 150 custom reports to be created.

Tips and Best Practices for GA4

Migrate you historical Universal Analytics data

When transitioning to GA4, the historical data of your store collected in Universal Analytics will not be migrated. Furthermore, it will be deleted in about half a year after the July,1 2023.

To preserve this valuable information use tools to export the historical analytics data.

You have the following options to export the UA historical data:

  • Export individual reports in CSV, TSV, TSV for Excel, Excel (XLSX), Google Sheets, PDF formats.
  • Export data via the Google Analytics Reporting API.
  • Export data to BigQuery.

Read on how to export individual reports, and here is a manual by Google on export to BigQuery.

Align events in your apps and web

To ensure consistency in data measurement between app and web platforms in Google Analytics 4, it is essential to align the events.

Here are some key considerations:

  • Event naming. Ensure that events are named consistently across both platforms. Avoid using different names for the same event.
  • Event parameters. Maintain consistency in the parameters associated with the same events. Avoid passing different parameters for the same event from the app and the web.
  • Parameter Values. Ensure consistency in the parameter values passed from the app and the web. If you choose a US country_code for USA, use if in the app anf the web.
  • User ID. Bee consistent in the type of the User ID value. For example, avoid passing it as a string from the app, but as integer from the web.

By maintaining a consistent implementation, you can ensure that your app and web data are comparable. This allows you to obtain an accurate understanding of the user journey across multiple platforms.


Google Analytics 4 offers multiple advantages in user tracking and data displaying over its predecessor, Google Analytics 3. The main benefit of new analytics is the ablility to track user-generated events on your website, mobile app and other sales channels.

For several years businesses could choose what analytics to use, but starting July 2023 the Google Analytics 3 will be discontinued. Upgrading to Google Analytics 4 is now a mandatory step for businesses to harness the full potential of website and app analytics.

You can migrate your Google Analytics 3 property to Google Analytics 4 and take advantage of the new features to gain deeper insights into your audience and drive better business results.

Alternatively, you can launch a fresh new Google Analytics 4 properti and configure it from scratch. Use the article How to setup Google Tag Manager in Magento 2 store as a step by step guide.

Eugen Barilyuk


Eugen, a tech-savvy writer at an IT company. He spends his days simplifying complicated tech stuff into easy-to-read blog posts and documentation. Eugen loves blending his love for tech with storytelling, making complex topics not only understandable but interesting. Beyond work, he enjoys exploring the creative side of technology and innovation.