Google Analytics 4 in Shopify using Native Integration

by ShahzadaAliHassan - 30th October 2023

Introduction

In this blog, we are going to explore how you can configure Google Analytics 4 (GA4) for your Shopify store using native integration. By the end, you'll understand how to track e-commerce events like "view item", "add to cart", and "purchase" to gain insights into user behavior.

Google Analytics provides us invaluable insights into our store's performance and customer behavior without the need for deep technical knowledge. It's a must-have for Shopify store owners who aim to optimize their business operations.

Two Main Approaches to Shopify Analytics Setup

There are two primary methods to achieve this:

  1. Utilizing Google's channel integrated with Shopify, providing a holistic solution to most tracking needs (this Blog).
  2. A more custom and robust approach using Google Tag Manager's web and server containers (will be covered in future blogs).

In this guide, we'll focus on the first option, employing Google and YouTube sales channels for Shopify to monitor events on GA4.

Advantages and Drawbacks of Google's Built-in Channel

This process is fairly straightforward. However, one significant drawback is its inability to track all traffic. Estimates show tracking rates of around 60% to 90%. Factors like ad blockers, iOS's ITP restrictions, and EU data protection regulations hinder complete tracking.The native integration does not track the following events by default either:

  1. View Item List (view_item_list)
  2. View Cart (view_cart)
  3. Add Shipping Info (add_shipping_info)

The first two missing events can be added via google tag manager, and the blogs can be found on the website. However, to improve the accuracy of tracking, shifting from Google's built-in channel to Google Tag Manager is the solution, demanding more resources (we'll tackle that in future blogs).

There are also issues with Upsell Tracking that are discussed later in this blog.

TipsRemember that while the built-in configurations are great for beginners, a more custom setup might be required for advanced tracking needs.

Prerequisites

Before starting, ensure:

  1. You have a Shopify store.
  2. A Google Analytics 4 account is set up.

Creating a Google Analytics 4 Account

If you're new to GA4:

  1. Visit Google Analytics
  2. Follow the account creation process, naming your property (e.g., "TrackingAcademy").
  3. Enter your website details and proceed through the setup.

Data Stream Setup

A data stream is a pipeline transporting data from Shopify to GA4. Here's how to set one up:

  1. Under "Property" in GA4, select "Data Streams".
  2. Choose the appropriate stream type (web, for Shopify).
  3. Enter website details and create the stream.

Integrating Google and YouTube Channels in Shopify

  1. In your Shopify dashboard, navigate to "Sales Channels".
  2. Search and select "Google and YouTube".
  3. Install the sales channel, then authorize the app for complete integration.
  4. Connect the appropriate GA4 property.

To validate, visit your Shopify store. You can also use Chrome extensions to check for Global Site Tags, which Google uses to dispatch various tags.

Testing the Integration

Perform actions like viewing items, adding to cart, and starting checkout. Then, return to GA4 to ensure these events are being logged correctly.

TipsRegularly test and verify that all events are being tracked correctly to ensure the accuracy of data.

Making a Test Purchase

  1. Add an item to your cart and proceed to checkout.
  2. Use dummy user data to simulate the purchase process.
  3. Return to GA4 to verify that events like "add payment info" and "purchase" are being captured.

NoteSome events, like "view_item_list", "view_cart" and "add_shipping_info", might not be enabled by default.

Upsell Tracking

Another issue related to native integration is Upsell Tracking, the default channel, does not track the conversions made on the second upsell. GA4 only records the first conversion event that fires on the Purchase flow, it deduplicates every other purchase event since they all have the same transaction_id parameter. There is a solution, however that will be discussed in the later blogs. You can refer to this Upsell Tags Page in future, for updates.

Conclusion

Choosing the right configuration and ensuring that all events are correctly tracked is vital for getting accurate analytics data. While Shopify's built-in tools and the Google and YouTube sales channels offer a simplified way to connect with Google Analytics, it's important to note their limitations. For businesses that require more detailed tracking or those operating in regions with strict user privacy regulations, additional configurations or tools may be necessary.

TipsConsider integrating other tools or platforms as your e-commerce business grows to gain deeper insights into user behavior and sales trends.

By following these instructions, users can make data-driven decisions that can positively influence their e-commerce strategies. Remember to regularly review and refine your configurations to keep up with evolving business needs and digital landscapes.