Google Analytics

GA4 Ecommerce Guide: Tag Manager, Cross-Domain Tracking, and More

Using GTM for eCommerce, Tracking Events, Testing Your Setup, Cross-Domain Tracking & More!

Main Image Courtesy of Bounteous

eCommerce Interactions 

With Google Analytics 4 (GA4), you can analyze and improve the shopping experience of your customers. It allows you to identify areas of your business that can be improved and make changes to improve it. In addition, it lets you see how your conversions perform and which marketing techniques work best.

eCommerce Tracking may seem a bit overwhelming at first if you’re not so familiar with the process, so continue reading to find out everything you need to know about eCommerce tracking, cross-domain tracking, and more!

What You Need to Get Started With eCommerce Tracking 

First things first, you must first choose a method for collecting data related to your eCommerce business. This is done through either Google Tag Manager (GTM) or Global Site Tag (gtag.js). These two methods allow you to customize the way Google Analytics 4 collects and displays data. Before you start implementing a strategy, it’s important to understand the differences between these two methods.

Difference Between Google Tag Manager and the Global Site Tag (gtag.js)

There are two ways to deploy gtag.js and GTM for GA4. GTM  is an online tool that enables you to update third-party and Google tags on mobile apps and websites without writing a lot of code. It also has versioning and collaboration capabilities.

The other option is to use the Global Site Tag framework, which is a JavaScript component. It can be used to add tags to web pages and mobile apps. Unlike Google Tag Manager, Gtag.js only requires JavaScript code to send data to Google Analytics.

Setting up GTM for Your eCommerce Website 

Google Tag Manager graphic
To access the Google Tag Manager, go to the top-left portion of your Google Analytics' dashboard and click on the "All Accounts" tab. You can then click the "Tag Manager" icon and follow the instructions. Image Courtesy of Semrush.

First Time Users 

If you are new to GTM, create a new container and an account from the site's homepage. An account in GTM will allow you to manage all of your tags in one place.

To create an account, go to the Accounts tab, click on the "Create Account" button, and then select the country that you want to create an account for. Then, add a descriptive name to the New Container field, and choose a type to march your chosen platform.

On the next page, click "Create" and then "accept the Terms of Service." After you've created your GTM container, click on the "Installation" button and it will take you to the GTM dialog box. If you're not ready to proceed, click "OK" to continue.

These are the codes that will allow you to install GTM on your eCommerce site's. To add more containers for different sites, you should create separate ones for each app or site.

To add a container for another platform, go to your Tag Manager's homepage and click on the "Add a Container" button. You'll then be able to create one next to your GTM account. Keep in mind that you don't have to create a new GTM account for every website or app.

eCommerce Interactions to Track 

eCommerce tracking can measure customer actions that include:

  • Making purchases
  • Requesting refunds
  • Adding/removing item from shopping cart
  • Initiating checkout process
  • Applying promotions 

One of the most important steps that you should take is to identify the events that will be collected by Google Analytics. There are two categories of events that the platform can collect: automatic and manual.

Manual events include recommendations and custom events. The former is defined in Google Analytics and includes predefined parameters and names. On the other hand, the latter is required for meaningful analysis and involves creating custom reports. You should also expect to get most of the eCommerce events you need via recommended events.

Setting up GA4 eCommerce Events with GTM

As an add-on to an eCommerce event, GTM can display various products or services in an array. This can be done with 27 custom parameters and up to 200 elements. Creating a collection of these items can provide you with more detailed tracking reports.

Setting up a Google Analytics event tag in GTM  is the first step in creating and implementing a GA4 event for your eCommerce site or app. This allows you to set up rules that will allow you to collect the necessary data from your site.

You'll need to create a custom macro that will allow GTM to access data from your site's product pages. This will help you pull in various details about your products, such as their prices and descriptions.

To create a new event, go to the GTM's side menu, click on the "New" button, and then enter the name of the event that you want to create. For instance, "Purchase" should be the name of your event.

In the eCommerce Data Layer section, click on the "Variables" button and then click on the "User-Defined Variables" option. You can then enter the name of the variable that you want to create and the corresponding data layer name. To save the changes, go to the next section and click "Save."

Test Your Setup 

Before you start publishing new events, it’s important that you first preview your changes. Doing so will allow you to test if your Google Analytics software is ready to track your data. In addition, testing will help ensure that your data is correct.

To start using the Google Tag Assistant, go to GTM and click on the "Preview" button. This will allow you to preview the features of the tool. After that, you will be notified about any errors that may have occurred in your setup.

Go to your website's URL and enter the container you installed for the Tag Manager. If you encounter errors, you can try debugging using the Tag Assistant.

In the settings section, click on the "change settings" button. This will allow you to fix the issues related to your tags. For instance, if an event triggers an incorrect trigger, such as when a page is loaded, then you should try to fix this issue.

Repeat the process to get the tracking you want. Once your tag is working properly, it's time to publish your workspace. To do so, go to the top-right of your Tag Manager and click on the "publish" button. You'll be able to review your changes and enter a description and a version name.

Real time reports example
After everything is as planned, you can access your events and variables from the Debug View and Real Time reports. Image Courtesy of Search Engine Watch

Cross-Domain Tracking & GA4 Process

One of the most critical factors that you should consider when it comes to collecting data in Google Analytics is ensuring that you are accurately tracking your users' journey. However, if you have multiple domain names, you might end up with an inflated amount of data.

One of the most effective ways to track a user's journey is through cross-domain tracking. This feature allows Google Analytics to send identifiers from one website to another so that it can track the same individual on multiple sites.

When a visitor goes from one domain to another, such as from domainA.Com to domainB.Com, Google Analytics 4 would pass a parameter to the latter's URL. This will allow the GA on the latter to update its version of Google Analytics and recognize that it's only one person doing the navigating.

Why is Cross-Domain Tracking Important?

Setting up cross-site tracking for your multiple websites is very important when it comes to setting up your Analytics property.

First-party cookies are used by Google Analytics to collect information about your users. When a user visits a certain website, they will be sent a cookie that will store their unique identity.

These cookies cannot be used to track a user's movement across multiple websites. In the case of multiple websites, Analytics will record the user as two separate individuals.

This issue can seriously affect your data collection. For instance, if you have multiple websites, you might end up with two different sets of users for each site. This issue can make it seem like you have a lot of users, which can affect your metrics. Also, if a user moves from one site to another, they might be referred to as a "self-referral."

One of the most effective ways to resolve this issue is by implementing cross-site tracking. This will allow Google Analytics to collect information about your users as they move between multiple websites.

Cross-Domain Tracking Setup in GA4

  • In the "Property" section of your GA4 property, click on "Data streams." Then, go to your web data stream.
  • In the "Configure your domains" section, click on the pencil icon and enter the details of the domains that you want to track.
  • Go to the "Add condition" page and enter the details of your domains. You can then click "Save" to complete the process.

Test Cross-Domain Tracking Configuration 

DebugView in GA4
To configure cross-domain tracking correctly, you'll need to take advantage of the debug view. To do so, go to the "Configure" section, and then click "Debug View." Image Courtesy of Data Driven U.

The debug view allows you to create a real-time report that you can use to test your cross-domain tracking. To verify that you're tracking properly, open up the view and then interact with your domains.

When creating cross-domain tracking, you'll trigger GA4 to record the outbound link clicks that you make from one site to another. These are marked as "clicks" in the debug view. You can see them if you click on an embedded link while visiting one of your sites.

Setting up cross-domain tracking will allow you to confirm that it's working properly. One of the first things you'll notice is that it won't record the link clicks that you make from one site to another. This means that the configuration of the system is correct, and you can then test this by moving to another site and using the embedded link.

You can also check the link's URL as you navigate from one site to another to confirm the configuration of cross-domain tracking. After you've created cross-domain tracking, go to the next site and click on the embedded link. If you see the query parameter _gl in the URL, it's working properly.

Start Your eCommerce Journey with GA4 Today

The rise of GA4 has resulted in fewer configuration options in the GTM code. However, this doesn't mean that GTM is no longer necessary. There are still many applications that require it, such as eCommerce and cross-domain tracking. While these two processes may seem complicated at first to get accustomed to, you can always stop back if you run into any issues!

Google also has a training guide and support page for GA4 here, which is another useful tool to help you navigate through everything. 

Get great insight from our expert team.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By signing up you agree to our Terms & Conditions