How To Obtain 100% Accurate Sales Data in Google Analytics 4 (GA4) via Measurement Protocol

Loading...
Back to Blog
How To Obtain 100% Accurate Sales Data in Google Analytics 4 (GA4) via Measurement Protocol

Google Analytics 4 has become a crucial measurement tool for any eCommerce business, including those built on the Magento 2 platform, due to the recent Google announcement that standard Universal Analytics properties will be retired and will not be collecting new data, starting July 1st, 2023.

Between this and other major obstacles that regular client-side tracking faces on the internet at the moment, such as Ad-Blockers, 3rd party cookie restrictions, browsers that restrict or outright block JavaScript and other specific privacy controls, accurately measuring user activity and the whole customer journey, as well as eCommerce metrics such as sales and other important events and details on your website is becoming more and more difficult. This also makes it harder to properly target users via Google Ads.

Fortunately, there are ways of surpassing these obstacles and ensuring your website sends accurate data and insights to Google Analytics, ensuring you have more control over the data you analyze and measure, as well as the ability of understanding exactly what your users and customers are doing across all your websites. One of the best and most simple ways of achieving this and future-proofing your website via Google Analytics 4 is to use Measurement Protocol.

What is Google Analytics 4 Measurement Protocol?

In a nutshell, the Google Analytics 4 Measurement Protocol augments existing web and app streams, enabling website and app data (from mobile apps) to be sent to Google Analytics 4 via HTTP requests, making it easy to track and measure interactions that happen server-to-server.

How do I implement Google Analytics 4 Measurement Protocol?

The implementation process for Measurement Protocol normally requires the assistance of a developer that can follow the Google Documentation and set up a custom functionality that would enable your store to access and send event data via HTTP requests. Fortunately, with our Google Analytics 4 (GA4) With GTM Support for Magento 2 extension, setting up and using Measurement Protocol is a breeze. We'll explore exactly how to do this below!

Basic Setup for the Google Analytics 4 PRO extension

This guide assumes you've already set up and configured the Google Analytics 4 PRO extension via the included steps in the documentation. If you haven't done so, you can follow the instructions in the User Guide.

Note: Basic Setup and client-side tracking are available via the standard version of the Google Analytics 4 extension, however, Measurement Protocol is available only in the PRO version.

Enabling and configuring Measurement Protocol

Once the extension's basic setup is completed and you've confirmed data is flowing into Google Analytics via client-side tracking, follow the steps below to enable and configure the Measurement Protocol functionality:

  1. Head into your Magento Admin and navigate to WeltPixel -> Google Analytics 4 eCommerce PRO GTM Settings.

  2. Scroll down to Measurement Protocol Tracking Configuration and expand the configuration options.

    Google Analytics 4 - Measurement Protocol Settings
  3. Set the Enable Measurement Protocol Tracking Configuration option to Yes, which will allow you to continue the configuration.

    Google Analytics 4 Measurement Protocol Settings Expanded
  4. Next, input your Measurement ID, which you should already have from the basic setup completed previously.

  5. The next piece of data you'll need is the API Secret. To find it, head into your Google Analytics 4 property and open Settings. Click on Data Streams and select the Data Stream you created during the basic setup.

    Google Analytics 4 Data Stream
  6. Click on Measurement Protocol API Secrets, review the terms and click on Create to set up a new Secret Key. Choose a nickname for the key and click Create again.

    Google Analytics 4 Measurement Protocol API Secret
  7. Once the key is created, you can find it in the list and copy it by clicking the Copy button.

    Google Analytics 4 API Secret List
  8. Head back into the Magento Admin and paste the key you copied in the API Secret field.

    Magento Admin Measurement Protocol Settings Configured
  9. Next, you'll need to select the events you want to track via Measurement Protocol. Note that, if you plan to track an event via Measurement Protocol, you'll need to disable it for client-side tracking in order to avoid duplicating the data in Google Analytics.

    Magento Admin Measurement Protocol Selected Events
  10. Optionally, you can enable reporting via log files for more hands-on data with the following two settings. Click Save Config and flush the Magento Cache from the Cache Management section.

Disabling Client-Side Tracking for events tracked with Measurement Protocol

In order to avoid duplicate data flowing into Google Analytics, the events you choose to track server-side should not also be tracked client-side. Disabling tracking for those is quite simple and it only requires you to pause the client-side tag from firing via Google Tag Manager.

  1. Head into your Google Tag Manager Dashboard and select your Google Tag Manager Container.

  2. Click on Tags and select the tags you'd like to pause. In this case, we're selecting everything apart from the main Analytics tag, which is required. It's important you don't pause this tag as it's needed for user activity tracking, such as page views and sessions.

    Google Tag Manager Select Tags
  3. Click the Pause button, which will ensure the selected tags no longer fire.

    Google Tag Manager Paused Tags
  4. That's it! Save the changes and publish the container with the updates.

Monitoring the Data that flows into Google Analytics 4

To check and make sure everything is working correctly, you can use the Realtime section of the Google Analytics 4 dashboard to view the live events flowing in. You should see all of the events you selected under the Track Events option in your Magento Admin being populated in the Realtime section as you perform actions related to those events on your website.

If you've just set up the property and the extension, you won't see the more advanced reports being populated just yet, so don't worry. It can take around 48 hours for the reporting to start being generated.

For more advanced debugging and monitoring of sent data, you can use Google Tag Manager's Preview Mode, as well as the logs that the extension generates!

Once you've followed all these steps, the events you set up tracking via Measurement Protocol for should flow into Google Analytics 4 with 100% accuracy!

Related Products