Chapter 4 - Google Analytics Setup

Magento 2 SEO Guide

Introduction

One of the most important things for SEO success is being able to measure it, and that’s why ensuring something like GA4 is tracking correctly on your Adobe Commerce store is so important.

In this chapter, we’ll take you through what you need to know to get tracking up and running on your website. For this purpose, we do assume that you already have a Google Analytics account set up and that you already know your Google Analytics measurement ID.

To find your measurement ID, head to your GA4 property: Admin > Data Collection and Modification > Data Streams

There you’ll select your website and inside you’ll find your measurement ID. 

Example Data stream from GA4.

Setting up Google Analytics (GA4) for Adobe Commerce

With your measurement ID in hand, the simplest way to implement it on your Adobe Commerce store is via the default settings available in the configuration menu. Head to Stores > Configuration > Sales > Google API and depending on your version of Magento you’ll see a few settings for “Google Analytics” or “Gtag”. 

If you’re implementing via GTM, click yes to enable and ensure the Account type is set to “Google Tag Manager”. You can configure some of the settings below, but in most cases you can leave them as is and you’ll be good to go! Just make sure you have your pageview tag set up in GTM. 

If you’re setting it up via the gtag, you can do so under “Google Gtag” like the below. Once again click “yes” to enable, and then just add your measurement ID! It’s as simple as that.

Google Signals (Demographics)

Demographic data has changed a little with the advent of GA4. Google analytics no longer tracks things like age, gender, interests and so on right away, and you instead have to opt in.

To do so is fairly simple, you just have to make sure that your own privacy policies are up to standard and fully identify that you will be tracking this kind of data. Get more advice from Google on what to consider here.

To turn Google Signals on, head to your GA4 property and go to Admin > Data collection and modification > Data Collection and turn it on!

eCommerce Tracking

Knowing what products your users are interacting with is one of the most important things for your eCommerce website, and unfortunately this is not included in the default Magento 2 configuration.

To set it up, you will need to get a 3rd party module that can create the datalayer for you, or look into creating that datalayer manually.

Creating the datalayer with modules

At PushON, we usually recommend that our clients use a 3rd party module to handle the datalayer eCommerce events. The benefit of doing so is the ease first and foremostly, but also that many of these modules come with great continued support and updates from the provider.

Our two preferred options are:

Anowave – Magento 2 Google Analytics 4 (GA4) GTM Extension

https://www.anowave.com/marketplace/magento-2-extensions/magento-2-google-analytics-4-enhanced-ecommerce-tracking-gtm/

  • Fantastic help desk service for any issues you may face, 
  • Comes with options to test on staging environments,
  • Includes GTM, Google Ads and Meta tracking functionality,
  • Completely covers the recommended Enhanced eCommerce event structure recommended by Google,
  • And it’s compatible with things like Hyvä.

Amasty – Google Analytics with GTM Support

https://amasty.com/google-tag-manager-for-magento-2.html

  • Completely covers the recommended Enhanced eCommerce event structure recommended by Google,
  • Optimised for Hyvä,
  • And the install is very simple!

Both of these options work via GTM, where they create the all of the tags and triggers inside of Google Tag Manager for you. All you need to is plug in the right access information.

A snapshot of several ecommerce events in Google Tag Manager

If you are using this approach to your analytics, make sure you don’t have your measurement IDs or GTM IDs in the default Magento GA solution (Store > Configuration > Sales > Google API) as this will lead to duplicate tracking!

 Manually Creating the Datalayer

If investing in a 3rd party module isn’t an option for you, you can manually create the datalayer yourself. With this route, you could either create the events in Google Tag Manager, or use gtag.js, the JavaScript tagging framework from Google that can send everything straight to GA4.

Both of these options are effective and have different benefits, but they do both require intervention from a developer which may end up being costly.

Google has an in-depth guide on how to do either route, and the important thing is ensuring your items array is accurate. Stick to the syntax Google outlines in that guide as close as possible so that you can rest assured Google can understand the information you send them.

Checkout Goals and Funnels

If you have followed the recommended syntax for your eCommerce events perfectly, you should see the two default funnels in GA4 populated with your data.

Head to Reports > Monetization and you should see two different journey reports available in the list.

Purchase Journey 

This funnel covers a user’s journey from starting a session to viewing a product page, adding it to their cart, beginning the checkout and then finally purchasing. You’ll be able to toggle whether the funnel is open or closed, which is whether a user has to join at the start and pass through every event or whether they can join at any point in the funnel. The events it looks for are:

session_start > view_item > add_to_cart > begin_checkout > purchase

Checkout Journey 

The checkout funnel zooms in a little more on what happens between beginning the checkout and purchasing. Here we can see whether users are making it through adding their shipping info and their paymet info. The events this report relies on are:

begin_checkout > add_shipping_info > add_payment_info > purchase

Other things to consider for Adobe Commerce GA4 Tracking

Internal Site Search Tracking

In theory, this should work right away but it’s always worth a quick double check! In the GA4 admin, navigate to the Data Stream view (Admin > Data Collection and Modification > Data Streams) and click the cog icon under “enhanced measurement”. This opens up all the default measurements GA4 can collect. 

Here, we can configure what parameters Google Analytics looks out for in the URL to detect an internal search result. By default, Magento sites use this structure: /catalogsearch/result/?q=hello, where the search term follows the “q” parameter.

To make sure your GA4 is set up for this, click “Show advanced settings” under “Site Search” and check that it is specified under the parameters:

Site search in GA4, configured to detect certain parameters

Comparisons and Segments

In Universal Analytics, we could create custom segments to analyse specific groups of users to find insights to improve marketing or site performance.

In GA4, it’s a little different. We don’t have a perfect like for like, but we can get the same functionality out of using their comparisons tool. This lets you build up to 5 conditions based on the available dimensions in your property. To access it, click the black and white rectangle icon in the right hand corner of GA4: 

Here you’ll find a selection of prebuilt comparisons for the main traffic channels and some more to differentiate web, mobile and tablet traffic. To build your own, select “Create new” in the top right. Here you can create a set of conditions that specifies users in certain cities, who landed on certain pages or even certain demographics with Google Signals turned on.

Once built, or with a pre-built one selected, you can apply that to your current reports view and you’ll see your comparison against all users. 

Keep reading to discover more about Magento 2’s Extensions and Downloads in the next chapter.

Do you need help with your SEO for eCommerce?

Contact us on 0161 820 7628 or email us today

Related Articles

12 Ways to Maximise Paid Media for Black Friday Success

12 Ways to Maximise Paid Media for Black Friday Success

Black Friday is a prime event for digital marketers looking to maximise conversions and revenue. With intense competition and high consumer expectations, a robust paid media strategy can make a huge difference. The following tips, derived from expert recommendations,...

read more
Cost-effective tactics for navigating CPC surges

Cost-effective tactics for navigating CPC surges

Associate Director of Marketing, Alex Hogan, speaks at Brighton SEO 2024 about navigating CPC surges in the PPC space. Last week, we had the privilege of attending the world’s largest search marketing conference, Brighton SEO, where we were able to watch industry...

read more