How to Set Up and Enable Ecommerce Tracking in GA4

In today's fast-paced ecommerce landscape, understanding customer behaviour doesn’t just provide you with a competitive edge; it's the key to unlocking growth and success. One of the best, and not to mention, free, ways to track customer behaviour and see comprehensive ecommerce insights is with Google Analytics 4 (GA4).

If you're a business owner looking to harness the full potential of your online store, the experts at Dropshipzone have created a step-by-step guide on how to set up and enable ecommerce tracking in GA4. From understanding the intricacies of event tracking to unleashing the power of user analytics, our guide will explain the process, helping you turn customer data into valuable business insights.

Google Analytics 4 is the latest evolution in Google's analytics suite to provide a comprehensive tracking tool for user interactions on your website.

What is GA4 ecommerce tracking?

Google Analytics 4 (GA4) is Google’s newest analytics tool, replacing Universal Analytics. GA4 tracking is the latest evolution in Google's analytics suite, designed to provide a more comprehensive and user-centric approach to tracking user interactions on your website or app. GA4 goes beyond its predecessor, Universal Analytics, by offering enhanced customer metrics, more flexibility in event tracking, and a focus on machine learning-driven insights. When it comes to ecommerce, GA4 tracking is a powerful tool that allows businesses to gain a deeper understanding of user behaviour, optimise conversions, and gather more precise ecommerce reports.

In the ever-evolving landscape of ecommerce, staying ahead of the curve is essential for businesses seeking sustainable growth. GA4 is a game-changer for business owners, offering a comprehensive analytics experience.

With GA4, you can track some of the following ecommerce actions:

  • Item categorisation such as item affiliation, item category, item promotion CTR, and items viewed in the promotion.

  • Transaction and revenue-specific events such as first-time purchaser conversion rate, items added to cart, items checked out, item revenue, item purchases, total purchases, and purchaser conversion rate.

  • Ecommerce unique metrics such as add to cart, average purchase revenue, average revenue per user, checkouts, and total revenue.

Some of the key ecommerce actions you can track with GA4 include item categorisation, ecommerce unique metrics and transaction events.

Key features of GA4

GA4 adopts an event-centric model, allowing businesses to track a wide array of user interactions beyond traditional pageviews. Events can include clicks, video views, and interactions with dynamic content, offering a more nuanced perspective on user engagement. It also places a strong emphasis on ecommerce tracking with advanced features under the Enhanced Ecommerce suite. This helps online businesses gain deeper insights into the entire customer journey, from product views to purchases, enabling more informed decision-making.

GA4 uses machine learning to provide automated insights and ecommerce businesses can benefit from AI-driven reports that highlight significant trends, anomalies, and opportunities, ultimately saving a lot of time that can be used to focus on other aspects of the business.

2024 promises to be the year of multichannel approaches for both customers and businesses alike. With customers looking to shop on a variety of platforms and businesses attempting to adhere to this, there comes a need for accurate tracking. GA4 not only allows for this but ensures seamless cross-platform tracking. Businesses can gain insights into user interactions across websites, mobile apps, and other digital platforms, allowing for a more cohesive understanding of user behaviour across a wide range of channels.

Benefits of GA4 in ecommerce

As previously discussed, the capabilities of GA4 in providing detailed insights into every step of the ecommerce funnel empower businesses to optimise their marketing strategies, enhance user experience, and ultimately increase conversion rates by identifying and addressing bottlenecks in the customer journey. GA4 was built with ecommerce businesses in mind, and with it, you can see the full influence of your sales and marketing efforts in one place. This means that businesses can analyse things like product views, cart additions, and purchase behaviour. These insights are crucial metrics that can tell you a lot about how your customers are shopping, allowing for data-driven decisions to improve product offerings and marketing initiatives. Knowing your customers is crucial, and with GA4, businesses have access to a robust audience builder, enabling them to create highly targeted segments based on user behaviour, demographics, and other custom parameters. This level of customer insight empowers marketers to tailor their strategies to specific audience segments for more personalised engagement, resulting in a higher return customer rate.

As the digital landscape continues to evolve in 2024, GA4 will help ecommerce businesses prepare for the future. Its flexible and adaptive design and extensive capabilities ensure that businesses can stay ahead of emerging trends and technologies, something that is crucial for the longevity and success of any online business.

How does GA4 tracking for ecommerce differ from Universal Analytics?

Google Analytics 4 and Universal Analytics (UA) both represent distinct chapters in the journey of web analytics, each offering unique features and capabilities. Since GA4 is a replacement, users will lose access to the UA interface on July 1, 2024. That’s why understanding the differences between the two is crucial for businesses aiming to make informed decisions about their digital strategy, as GA4 is something every business owner will be using if they aren’t already.

At its core, GA4 serves as a tool for tracking and analysing user interactions on websites and applications. The evolution from UA to GA4 reflects a shift from session-centric to user-centric analytics, emphasising a more holistic understanding of user behaviour. Unlike UA, where tracking is centred around sessions and cookies, GA4 introduces the concept of the user as a central entity. GA4 tracks users across devices and sessions, providing a more comprehensive view of user engagement throughout their journey.

GA4 introduces a more dynamic approach to tracking with event-based analytics. In UA, tracking primarily revolved around predefined page views and goals. GA4's event-based model allows businesses to capture a broader range of interactions, from specific clicks and form submissions to custom-defined events tailored to the unique needs of each website. GA4 also integrates machine learning to offer businesses predictive metrics, enabling a more future-oriented perspective compared to UA. This includes metrics like Predicted Revenue and Predicted Conversion Rate, empowering businesses to anticipate trends and make proactive decisions.

GA4 is based on tracking events by a user and introduces a more dynamic approach in comparison to the session data of its predecessor.

For businesses dealing with vast datasets, GA4 streamlines integration with Google BigQuery, Google's cloud-based data warehouse. This allows for more robust data analysis, exploration, and customisation, catering to the needs of businesses with substantial data requirements. GA4 also integrates seamlessly with Google Tag Manager, simplifying the process of adding, updating, and managing tags on a website without the need for manual code changes. Compared to UA, GA4 focuses on providing unified insights across multiple channels. Whether users shop through a website or a mobile app, GA4 ensures a consistent tracking mechanism, allowing businesses to understand user behaviour across different touchpoints.

GA4 introduces the concept of user properties, enabling businesses to define and leverage additional attributes about users, such as their lifetime value, subscription status, or user type. This facilitates more detailed audience building and segmentation for targeted analysis compared to the capabilities of UA.

While UA has been a reliable tool for web analytics in recent years, GA4 represents the future, promising enhanced capabilities, a user-centric approach, and a more dynamic ecommerce tracking model. As businesses navigate the evolving landscape of digital analytics, understanding the differences between GA4 and UA becomes instrumental in making strategic decisions that align with their growth objectives. Embracing the advanced features of GA4 positions businesses to stay ahead of their competition and changing trends while also unlocking new possibilities for understanding and optimising the user journey.

Setting up GA4 tracking via Google Tag Manager

As we have discussed, ecommerce tracking is crucial to the health and longevity of any online business. It provides invaluable insights into user behaviour and drives informed decision-making when it comes to things like sales and marketing. With GA4, setting up ecommerce tracking through Google Tag Manager (GTM) is a critical step in unlocking the enhanced capabilities of GA4. 

Google Tag Manager acts as a powerful intermediary, allowing businesses to implement and manage various tags, including GA4 tags, without the need for manual code changes. Integrating GA4 ecommerce tracking via GTM provides a flexible and streamlined approach to capturing crucial ecommerce data.

Integrating GA4 ecommerce tracking via GTM provides a flexible and streamlined approach to capturing crucial ecommerce data.

Step 1: Set up a Google Analytics account and create a new GA4 Property and Data Stream:

If you haven’t already, you’re going to need to create a new Google Analytics account. From there, you can add your first property to the account. To create a property:

  1. In the Admin section, click Create, and then click Property.

  2. Choose a name for the property, this could be your business name or website. Then select your desired time zone and currency that matches the country you are operating in. If your time zone has Daylight Savings Time, GA will automatically adjust the time change. You can change your time zone at any time; however, Google suggests changing the time zone for a property no more than once a day so it can accurately process the change.

  3. Click Next and select your business size and industry category.

  4. Click Next and select your desired intention for Google Analytics. Choosing your desired intention helps Google tailor your default reports to you and your business needs. Some of the intentions to choose from include: Generate leads, drive online sales, raise brand awareness, examine user behaviour, and baseline reports.

  5. Next, you can click Create and accept the terms of service if you are setting up a new account.

  6. To add a data stream, or the place where Google Analytics is pulling data from, click Add stream and enter the URL of your business website and include a Stream name.

  7. From here, you’ll be able to enable enhanced measurements, which means page views and other events will be automatically collected. It’s up to you what events you want to collect, but we suggest you enable all for now.

  8. Lastly, click Create stream.

Step 2: Install the container onto your website

  1. First, you’ll need to create a new container. Put simply, a container contains several tags and rules. In your Accounts tab, enter a new Container name and select the type of container you are creating. If you already have access to the Tag Manager container, skip to step 5.

  2. Click Create to finalise.

  3. To install the container, click Workspace in Tag Manager.

  4. You’ll find your container ID near the top of the window. Google will then direct you to copy and paste code snippets into your website in the Install Tag Manager box. For more information on how to place the code, refer to Google’s guide. Once you place this code onto your website, all tags will be fired when they are configured to fire.

  5. You can now add new tags to your container on your website. In the Workspace section, click Tags.

  6. Click New to add a new tag and enter a name for the tag.

  7. In Tag Configuration, select Google tag.

  8. Enter your Google tag ID in the Tag ID.

  9. Click Save. You have now installed the container and created a GA4 configuration tag.

Step 3: Set up GA4 Event tags

  1. Now that you’ve created a Google Tag in Tag Manager, it’s time to set up some events. In Tag Manager, click Tags and New.

  2. Enter a new name for the custom event you want to track. In this case, we will use the example “GA4 Event – Add to cart”.

  3. Click Google Analytics: GA4 Event.

  4. Now you can configure your measurement ID and enter a name for the event you are setting up, for example, 'add_to_cart'. Google has a list of suggested event names here if you need some ideas.

Now you’ve got your tags set up, you need to define triggers for the tag to fire when a customer loads a page or clicks a particular button. For ecommerce tracking, set triggers for relevant pages like product pages, cart, and purchase confirmation.

  1. Click the Trigger Configuration box.

  2. Click All Elements.

  3. Click Some Clicks.

  4. For our example, set the trigger condition- “Click Text contains Add to cart”.

  5. Click Save.

Step 4: Testing with GTM Preview Mode and GA4 DebugView

This step is essential and allows you to browse your website where your tag container code has been applied.

  1. To turn on Debug mode, click Preview in the top right-hand corner of Tag Manager (next to the Submit button).

  2. A new tab will then open, asking you to enter the URL you wish to test and debug. It will either be your website’s homepage or a specific page on your website, depending on what you are testing.

  3. Once the URL is entered, press Start.

  4. A new tab or browser will then open, and you will see a pop-up message indicating that the debugger is connected.

  5. Go back to the original tab, where you will click Continue.

  6. From there, enable Preview mode and click Initialisation on the left side of the screen.

  7. Once you click that, you should see your desired Google tag under Tags Fired.

  8. You then need to check that this data has reached Google Analytics to ensure that everything is working correctly. To check this, go to Admin, Settings, and DebugView.

  9. Once you click this, you’ll start seeing the data. This will enable you to click on each event and see a list of parameters. Click on the parameter you are testing to see that the value has been received by GA4.

Step 5: Publish the Tag

  1. Now that you have tested that the tags you have created work, you can publish them. Simply click the Submit button to publish.

  2. We recommend choosing to Publish and Create Version, making sure you fill out the name and description fields. This will help you distinguish between your tags in future.

  3. Now that your tag is published, you’ll be able to see the customers viewing your website and doing things like checking out.

Integrating GA4 ecommerce tracking via Google Tag Manager empowers businesses to harness the full potential of user-centric analytics and advanced ecommerce features. By seamlessly configuring GA4 tags, defining custom events, and leveraging the power of GTM, businesses can unlock actionable insights that pave the way for strategic decision-making and sustained growth. As the ecommerce landscape evolves, continuous testing, analysis, and optimisation will ensure the accuracy and relevance of your ecommerce tracking setup, providing a solid foundation for achieving ecommerce success in the digital era.

Setting up GA4 tracking via Google Tag (gtag.js)

Gtag.js is a tool used to send information from your website to Google Analytics and is implemented by installing a tracking code into the header of your website. Like GTM, gtag.js uses a data layer to pass information to tags. It requires users to be proficient in HTML, CSS, and JavaScript, so it is not as suitable for people with little to no knowledge of these. It removes the need to set up a tag management system as you can install the tags immediately onto your web page, but it is designed for web developers whose only focus is tagging.

Step 1: Setting up your Google Tag with Shopify

Google has a support page that allows you to set up your Google tag based on the website builder you use. For the purpose of our guide, we will be showing you how to set up your Google tag using Shopify.

Shopify integrates with Google Analytics for free. The instructions for setting up your Google tag differ for tag IDs starting with “AW-” and “G-”, we will go through both.

Setting up with a tag starting with “AW-”:

  1. Log in to your Google Ads account.

  2. Click the tools icon in the upper right corner. Under Setup, click Google tag.

  3. Then go to Configuration.

  4. Click Installation instructions, and select the option Install manually. Google recommends using Google and YouTube through Shopify to set up your Google tag and states that manual setup should only be done by advanced users to avoid any inaccuracies when it comes to tracking ecommerce events.

  5. Next, in the Shopify app, click Online Store and Themes. From there, you can select the Edit Code tool.

  6. Below the Layout section, choose the theme.liquid file. This is to ensure you don’t have any Google products currently installed and avoid duplication. If you have code that looks like the code below, chances are you already have Google products installed.

  7.  Insert the below gtag.js code after the <head> section of your HTML. Make sure that this code is present on all the pages you wish to track. This code is available in your Google Analytics account under Admin and Data Streams under Tagging instructions.

 

1.  <!-- Google tag (gtag.js) -->

2.  <script async src="https://www.googletagmanager.com/gtag/js?id=Tag_ID"></script> 

3.  </script>

4.  <script>

5.  window.dataLayer = window.dataLayer || [];

6.  function gtag(){dataLayer.push(arguments);}

7.  gtag('js', new Date());

8.  gtag('config', 'GA_Measurement_ID');

9.  </script>

  1. You can then click Save.

Note: Replace 'GA_Measurement_ID' with the Measurement ID copied from your GA4 property. Do not add more than one Google tag per page of your website.

Setting up with a tag starting with “G-”:

  1. Start by signing in to your Shopify account.

  2. In the dashboard, click on Online Store and click Preferences.

  3. Go to the Google Analytics account section and click Manage pixel here.

  4. From there, you can choose your Google tag ID from the list and click Connect your Google Analytics 4 property.

To add your Google tag manually:

  1. Once you are signed into your Google Analytics account, head to the Admin screen.

  2. Once in Data Streams, click on the desired stream to see details.

  3. You can now follow on from step 4 of the steps above, inserting the same code and clicking Save to finalise.

Step 2: Enable Enhanced Ecommerce Reporting

  1. Start by heading to this Google tag reference page. Scroll to the event section of the page.

  2. Here you will see some example code for setting an event, it will look like the following:

1.  gtag('event', '<event_name>', {<event_params>});

  1. You can paste this code into your HTML with whatever event you desire. You can also decide whether or not you will include any parameters for the ecommerce event. For example, the event you are tracking might be ‘add_to_cart_no_params’. If you want parameters, the code would look like this:

1.  gtag('event', 'add_to_cart', {

2.  ‘test_parameter’: ‘hello’,

3.  ‘test_value’: 5

4.  });

Note: The parameter limit per event is 25, and the length of a parameter cannot exceed 40 characters.

  1. Click Save once you are happy with your event tags and parameters.

Step 3: Test events with DebugView

  1. You first need to enable Debug Mode to see if your event tags are working on your website. One easy way to do that is to install a browser extension. This Google Analytics Debugger for Chrome works well and is easy to use.

  2. Once that is installed, turn on the extension on your website.

  3.  In your Google Analytics account, navigate to the DebugView section. You should now be able to see your events and parameters.

Why we suggest using Google Tag Manager over gtag.js

As we previously discussed, Google Tag Manager is a highly efficient tool to implement ecommerce tracking. It is much simpler and easier to use compared to gtag.js. With GTM, you don't have to worry about editing or writing HTML, which can be a difficult task. This means that even if you have no prior web development experience, you can still implement tracking tags on your website with ease.

Gtag.js, on the other hand, is restricted to Google tracking tools only. In contrast, GTM offers a wide range of comprehensive tools that are easy to use and implement. You can use GTM to do much more than just tracking website traffic. For instance, you can test your code, control different versions, and deploy multiple triggers to help you with your website tracking.

Even if you have extensive web development knowledge, using GTM is much more beneficial to your website compared to gtag.js. It is much less time-consuming to use a tag management system over having to enter codes manually. This means you can save a lot of time and effort by using GTM for your website tracking needs.

There are a few differences between gtag.js and Google Tag Manager, but ultimately using GTM is much more beneficial.

That being said, if your business has been using gtag.js for a long time, you may find it more practical to continue using it. Transferring your tags over to GTM can be a time-consuming process that may not be feasible for everyone. However, if you are starting from scratch or looking to upgrade your website tracking capabilities, we strongly recommend using or switching to GTM. It is the most up-to-date and comprehensive ecommerce tracking tool available through Google Analytics 4.

Compatibility with third-party tools

When it comes to choosing between GTM and gtag.js for your website's tracking needs, it's important to consider their compatibility with third-party marketing tools. GTM is a more versatile option as it can be integrated with any third-party tool that has a JavaScript tracking code. This means that you won't be limited to just Google tools for tracking and can easily customise your tracking to suit your specific requirements. On the other hand, gtag.js only works with Google's suite of tools, which can be limiting if you need to incorporate other third-party marketing tools for your website's tracking. Therefore, it's recommended to choose GTM if you're looking for a more flexible and customisable tracking solution.

User interface

When it comes to tracking website events, using gtag.js requires you to do all the tracking coding on your own. This means that you will need to have a basic understanding of JavaScript to implement even the simplest of website tracking. However, if you have a web developer, this shouldn't be an issue.

On the other hand, Google Tag Manager (GTM) provides a user-friendly interface that is significantly easier to navigate and use compared to gtag.js. Even if you're a beginner when it comes to ecommerce tracking, the interface is intuitive and requires no JavaScript knowledge, making it a much more effective and easy way for marketers to track ecommerce events.

With GTM, you can easily add and remove tags, and update tracking codes without having to modify the website's code. This not only saves time but also reduces the risk of introducing errors that can cause tracking issues. GTM also allows you to set up triggers and variables to track specific events and actions, giving you more control over your tracking data.

Functionality

GTM offers an abundance of features that make it a more efficient tool compared to gtag.js. GTM provides an easy and straightforward way to debug your code and implement newer versions of ecommerce tracking features. With GTM, you can easily manage all your tags in one place and track multiple events. On the other hand, gtag.js has very limited functionality and lacks the advanced features that GTM provides. So, if you want to efficiently manage your ecommerce tracking and get more insights into your website's performance, GTM is the way to go.

FAQ

Is Google Analytics 4 free?

Google Analytics 4 provides two versions of the software, a free and a paid version. The free version offers a wide range of analytics tools that you can access. On the other hand, the paid version, Google Analytics 360, offers premium capabilities such as extensive data limits and more advanced support.

Google Analytics 4 is the free software and Google Analytics 360 is only recommended for large companies that require more advanced support.

What is the difference between GA4 and Universal Analytics?

The key difference between the two software platforms is that UA records user sessions and page views, while GA4 records events and parameters. In July 2023, GA4 replaced UA, and all the tracking capabilities that were available on UA are now available on GA4.

START AND SCALE. LET’S GO!

Sign up now