Set Up GA4 on Shopify | Google Channel vs. gtag.js (2023)

Latest Update 2023 | GA4 x Shopify Tutorial | How To Set Up GA4 in Your Shopify Store

 

For every e-commerce store owner, having accurate tracking data and reports is very important for decision-making and development.

 

Latest GA4 x Shopify Tutorial | Shopify x GA4 Tutorial

It is very common to use Universal Analytics (Google Analytics old version, hereinafter referred to as UA) to track e-commerce stores, and you probably already have UA code in your online store. But after July 1, 2023, standard Universal Analytics properties will stop processing data! Google strongly recommends that you switch to Google Analytics 4 (hereinafter referred to as GA4) as soon as possible.

GA4 is Google's new generation of Analytics (analysis) that can collect event-based data from websites and applications at the same time (Source: Google Marketing Platform ). If you want to know more about GA4, you can check out the definition of GA4 and the difference between UA and GA4 in our Commonly Asked Questions session.

So how to correctly set up GA4 in Shopify in your Shopify e-commerce website, and improve the tracking and reporting capabilities of e-commerce?

Don't worry! Let me share a good news with you

In March 2023, Shopify introduced GA4 integration via Google Channel app - that means you can set up GA4 on your Shopify store without code and still be able to track basic e-commerce events!
We will share with you a complete Shopify tutorial to guide you through the steps of connecting GA4 with Shopify, and finally show how to use these features to optimize your e-commerce performance.

In this article, we will share with you three key points:

  • Step-by-step tutorial : How to set up GA4 to your Shopify store through 3 methods - via Shopify Google Channel App (no code required, highly recommended for basic tracking), via Google Tag Manager (advanced), or embedding GA4 gtag.js code into Shopify theme (advanced).
  • Introducing the 3 most important GA4 reports for your Shopify stores
  • Q&A: What is GA4? Is it important for my Shopify store? What is the difference between GA4 and UA? Are there other ways to track e-commerce events on Shopify?
So, let's get started! ๐Ÿ™Œ


1. Step-by-step tutorial: How to add GA4 or set up GA4 on your Shopify store

In this article, it is assumed that you already have a Google Analytics account. If you haven't had it yet, you can check out the official Google Analytics official document

Currently, there are 3 common ways to add or install GA4 to your Shopify store:

โญ๏ธ The easiest way to set up GA4 in Shopify with no code required - use Shopify Google Channel App to connect to GA4 account (highly recommended for basic tracking)
โญ๏ธ Use Google Tag Manager to track events and send to GA4 (advanced)
โญ๏ธ  Embed GA4 gtag.js code into Shopify theme code (advanced)

Let's see how to set it up and what's the difference between these two methods!

1.1. Connect GA4 to Shopify via Google Channel App
 no code required, highly recommended

In March 2023, Shopify introduced the method of using Google App Channel to install GA4 to track enhanced e-commerce events. We highly recommend this method because it doesn't require code and it can help you track basic enhanced e-commerce events such as view items, add to cart, purchase, and more. It takes less than 10 minutes for us to set up.


a. 5 easy steps to set up GA4 on Shopify

5 setup steps

Step 1. Create GA4 property
Step 2. On your Shopify website, download the Google Channel App
Step 3. Connect to your GA4 Account
Optional steps
Step 4. Delete the manually buried Google Analytics code (gtag.js code) code (if manually buried)
Step 5. Check if your GA4 is active

 

๐Ÿ“Œ Step 1 : Create GA4 property (if you already have one, please see step 2 )

First, you need to create a GA4 property. Go to Admin, click "Create property".

In Property Settings, set up your property name, enter your website name and URL, and select your time zone and currency.

Shopify x GA4 Tutorial | How To Setup A GA4 Property



You can use "GA4 Setup Assistant" to support if needed.

Shopify x GA4 Tutorial | How To Setup A GA4 Property
Image credit: Google Support

 

๐Ÿ“Œ Step 2 : On your Shopify website, download the Google Channel App

  • In your Shopify backend, search for "Google Channel App" or directly use this Google Channel App link to enter the app's page.
  • Click "Add app"

GA4 x Shopify Tutorial | Install Google Channel App To Your Shopify Store

 

GA4 x Shopify Tutorial | Install Google Channel App To Your Shopify Store

 

When you first log in to the Google Channel App page, click "Connect Google account" to connect Google account with Shopify.

Then click "Get started" to set up GA4.
2023 GA4 x Shopify Tutorial | How To Set Up GA4 To Shopify Store

 

๐Ÿ“Œ Step 3 : Connect your GA4 account

Latest | GA4 x Shopify Tutorial | How To Set Up GA4 Tracking To Shopify

If your account has many Google Analytics properties, you will see a list of all properties here

Select the GA4 property you want to track your Shopify store, click "Connect" and that's it!

*At this step, if you don't have a GA4 property, you will see a "No properties found" prompt. You need to create a new GA4 property to use this feature.

Latest | GA4 x Shopify Tutorial | GA4 Property Not Found

 

๐Ÿ“Œ Step 4 : Delete the manually embedded Google Analytics code (gtag.js code) in your Shopify store (if you embedded it before).

If you have manually set (embed) the gtag.js code before, you need to delete this code to prevent the gtag.js code from duplicating tracking data from your store.

  • The code may already be set into your theme.liquid file.
  • Go to Online Store -> Theme Settings -> Edit Code.
  • Go to theme.liquid and search for your gtag.js code and remove it.

*The code usually appears as follows:

<script async="" src="https://www.googletagmanager.com/gtag/js?id=X-XXXXXXXXXX"> </script> <script> window.dataLayer = window.dataLayer | | function gtag({dataLayer.push(arguments);}; gtag('js', new Date( )); gtag('config', 'X-XXXXXXXXXX'); </script>
๐Ÿ“ฃ Note: If you also set the gtag.js code in the Shopify order thank you page, please go to the lower left corner of the Shopify admin page > Settings > Checkout > Order Status > delete the gtag.js code.

 

๐Ÿ“Œ Step 5:

To check if your GA4 is active, you can use GA4 debug view or Tag Assistant *
*Google Tag Assistant is a free tool that helps you make sure your Google tags (such as Google Analytics, Google Tag Manager, Adwords Conversion Tracking, etc.) are working properly.

New GA4 x Shopify Tutorial | Tag Assistant

Check again that your Google Tag ID appears in the header, next to "Google Tags Found."

New GA4 x Shopify Tutorial | Tag Assistant Recognition
That's it ๐ŸŽ‰ ๐ŸŽ‰

If you need further Shopify consulting and services, we are here to help! (I need a consultant)

b. After connecting GA4 to Shopify through the Google Channel app, what customer activity events can you track?

Event name

Event Description

page_view

A customer browses a page of the website store

search

A customer searches for a product in the web store

view_item

A customer browses an item in an online store

add_to_cart

Customer adds an item to cart

begin_checkout

Customer starts the checkout process

add_payment_info

Customer successfully enters payment information

purchase

Customer completes the checkout process


If you'd love to more, do check out Shopify's official documentation on tracking other Google Analytics events

In addition to these automatic events, if you want to use GA4 to track other events in the web store, you'll need to edit Shopify e-commerce store theme code and use the gtag.js API to send events to your Google Analytics (analytics) account.

You can also track post-sale events by adding the script to your checkout settings in the Shopify admin .

If you want to know more about gtag.js code, you can read more in method 3 below

1.2. Method 2: Use Google Tag Manager to track enhanced e-commerce events and send to GA4

We highly recommend this video from Loves Data that well-explained how to use GTM to track events

 

You can learn more in this video:

  • How to setup GTM code in your Shopify store
  • How to exclude self-referrals in GA4
  • Setup ecommerce events in GTM and send to GA4

Also, to understand more about the concept of datalayer in GTM, you can check out this video from Analytics Manic

 

You can learn more in this video:

  • How to add data to the data layer (using dataLayer.push).
  • How to access data from the data layer (using custom event triggers and data layer variables )
  • The 3 most common rookie mistakes you must avoid when working with data layers.

  

1.3. Method 3: Add GA4 gtag.js code to Shopify theme code and use gtag.js datalayer code to track events

Using Gtag code is the preferred way for Shopify developers and merchants before Shopify GA4 integration via the Shopify Google Channel App.
gtag.js from Google is a tag that can be included on your website to give you access to a range of Google services and products, including Google Ads, Google Analytics, Campaign Manager, Display & Video 360, and Search Ads 360. Instead of managing multiple codes for different Google product accounts, just use Google code throughout your site and link the code to multiple destinations.

The latest GA4 x Shopify Tutorial | How to bury Shopify theme code using GA4 gtag.js code

*Image credit: About Google Code - Google Developers

 

The Gtag code needs to be integrated into the theme of the Shopify online store. It is recommended to let an expert to perform this setting.

Next, let us briefly share with you the setting steps:

- Step 1. Create GA4 resources
- Step 2. Add GA4 gtag.js code in Shopify
- Step 3. Track purchase events - Google Tag code (gtag.js code) - can be installed on the order thank you page
- Step 4: Set up datalayer code
- Step 5. Confirm whether your code is running normally

 

๐Ÿ“Œ Step 1: Create GA4 resources (please refer to the first step of the method above)

๐Ÿ“Œ Step 2: Add GA4 gtag.js code in Shopify

Next, you need to add the GA4 gtag.js code to your Shopify theme code. You can do this by following these steps:

  1. Log in to your Shopify account, go to Online Store -> Theme Settings -> Edit Code.
  2. Locate the theme.liquid file, which is the most important file in your theme. Find the <head> tag in the top half of this file .
  3. Add the following code to the <head> tag:
<script async="" src="https://www.googletagmanager.com/gtag/js?id=X-XXXXXXXXXX"> </script> <script> window.dataLayer = window.dataLayer | | function gtag({dataLayer.push(arguments);}; gtag('js', new Date( )); gtag('config', 'X-XXXXXXXXXX'); </script>
Latest GA4 x Shopify Tutorial | Add a Google Code.
๐Ÿ“ฃ Please note: Only one gtag code can be added to each page on the website. That means you shouldn't combine method 1 and 2.


๐Ÿ“Œ Step
3 : Track purchase events - Google Tag code (gtag.js code) can be installed on the order thank you page

Please go to Shopify Admin > Settings > Order Status page in Checkout and enter gtag.js code
*Using the Google Channel App method mentioned above, you don't need to put the code here to see the purchase time, isn't it amazing!

GA4 x Shopify Tutorial | Remove GA4 Code In Your Order Status Page

 

If you want to know more about the details of customer orders, you need to write more conditions to help more.
We strongly recommend you to use this code - Gtag purchase by Benjamin Mangold

๐Ÿ“Œ Step 4 : Set up datalayer code

What is datalayer? The datalayer serves as an object utilized by Google Tag Manager and gtag.js to send data to the set tags. It enables triggers to be established according to variable values.

To illustrate, suppose you wish to trigger a remarketing tag when the value of purchase_total exceeds $100 or when specific events occur, such as button clicks. In such cases, you can configure your data layer to provide the relevant data to your tags. The data layer object is structured in JSON format. Here is an example:

For this step, we highly recommend having engineers or experts to be involved. You can check out the official document from Google for more details.


๐Ÿ“Œ Step 5 : Confirm whether your code is running normally

Free tools available GA4 debug view or Google Tag Assistant to verify that the page is tagged correctly.

If Google Tag Assistant doesn't recognize your tags, see the setup reference provided in Tag Assistant.

 

1.4. Advantages and disadvantages of Google Channel App, GTM and Google Tag code (gtag.js)

Google Channel App

GTM / Google tag code (gtag.js)

Operations

Simpler compared to the other 2 methods

Slightly more complicated, requiring an understanding of the code structure of Shopify themes

Setup Time

Very fast, about 10 minutes to complete

Depending on the choice of theme, it could take hours in complex cases.

Event Tracking

No need to write code, can automatically track basic yet important e-commerce events of Shopify

You need to write datalayer code or set Google Tag Manager to track custom advanced events.

Expert Level

Need to understand basic Shopify settings

Have a very detailed understanding of Liquid code, theme structure datalayer code.

๐ŸŒฑ AkoCommerce Recommendation
If you want to focus on tracking the most basic enhanced e-commerce events, connecting GA4 through Shopify will be the easiest and most effective way. If you want to dig deeper into the analysis data, you can consider using GTM to assist in viewing together. If you need further Shopify consulting and services, we are here to help!
(I need more Shopify's advanced advices)

2. Introducing 3 Most Important GA4 Reports for Your Shopify Stores

Each store has different requirements for data reports. With years of experience as an e-commerce consultant and website builder, here we list 3 important reports that many e-commerce store owners in Taiwan love.

๐Ÿ—’๏ธ E-commerce overview report data report

First of all, one that must not be ignored - the e-commerce overview report! This report will give you an overview of your overall website performance.
Usually you can use the default reports provided by Google Analytics 4, and then based on these reports, you can get a general understanding of users, activities, top pages, top events, and conversions. If there are items that don't suit your needs, you can choose to customize the report content according to your preferences.

GA4 x Shopify Tutorial | E-commerce Overview Report

๐Ÿ—’๏ธ Product Performance Report

GA4 x Shopify Tutorial | Product Performance Report
Product performance reports are very important to your eCommerce business decisions. Using this report, you can get a complete picture of your top selling products and their revenue. You can also use different dimensions to gain insight into your product performance.
In this case, we're using traffic sources to understand where users are coming from, but there are more options for you to choose from.

๐Ÿ—’๏ธ Purchase path exploration

Purchase path exploration is an intuitive way to understand our customer behavior. Leveraging the funnel exploration feature,
you can easily use a funnel to explore what kind of behavior customers do before buying a product.
This way, you can gain a deeper understanding of possible causes of problems and optimize your online store for a smoother shopping experience for your customers.

GA4 x Shopify Tutorial | Purchase Path Performance Report

 

In this example, we examine the behavior of the following 4 steps: view item, add to cart, start checkout, purchase.

Donโ€™t forget to check out Analytics Insights , which uses machine learning techniques and the conditions you set to help you interpret data and take action, helping you easily view information and better understand your product characteristics.

Here are some questions you can try to understand, such as

  • Comparing the overall revenue and user profile analysis from "organic search" and "paid search".
  • Weekly revenue analysis for the past 12 months
  • Browsing data analysis of my top pages and websites

Interested in learning more about GA4 reports and the latest news? Stay tuned for more!

For you reference:

3. Commonly Asked Questions

3.1. What is GA4? Is it important for my Shopify store?

Google Analytics 4 (GA4) is the latest version of Google Analytics, released in October 2020. Its main function is to track website and application user behavior, and provide smarter, more flexible and more privacy-friendly solutions.

One of the key capabilities of GA4 is its ability to track cross-platform user behavior, enabling businesses to better understand how users interact with their website or app across multiple devices and channels, segment it, easily identify and target specific user groups .

GA4 x Shopify Tutorial | Google Analytics 4 Introduction


For Shopify eCommerce sites, GA4 is an essential tool for gaining insight into customer behavior and optimizing the online shopping experience. By tracking metrics such as page views, product views, and checkout behavior, businesses can identify product areas that need improved design, product, and marketing strategies.

Additionally, GA4's enhanced audience segmentation capabilities enable businesses to target specific customer segments with tailored marketing campaigns, increasing conversion rates and increasing customer loyalty.

GA4 is an essential tool for Shopify eCommerce stores looking to stay competitive in today's data-heavy environment.

Its advanced analytics provide valuable insights into customer behavior, enabling businesses to make data-driven decisions and optimize their online experience

Want to learn more about GA4? You can go to Google Analytics 4 Account Training Guide and Support to gain more insights.

3.2. The difference between GA4 vs. UA

Features

Google Analytics 4 (GA4)

Universal Analytics (UA)

Cross-platform tracking

yes

no

Event-Based Data Model

yes

no

Advanced machine learning

yes

no

Privacy protection

yes

no

Enhanced Audience Observation

yes

limited

Real-time data processing

yes

yes

Customizable Reports

yes

yes

User-Centric Reporting

yes

no

Integration with Google Ads

yes

yes

Integration with Google Marketing Platform

yes

yes

Data retention period

14 months

customizable

 

Overall, GA4 offers more advanced features than UA, especially in cross-platform tracking, machine learning, and privacy. GA4 also provides detailed analysis of user behavior on the event data model. In user-centric reports, companies can better understand individual user journeys.

However, both GA4 and UA are customizable and provide timely data processing, making them useful tools for analyzing website and application performance.

๐Ÿ“ฃ Please note: Standard Universal Analytics properties will stop processing data after July 1, 2023. Google strongly recommends that you switch to Google Analytics 4 as soon as possible.

3.3. Are there other ways to track eCommerce events on Shopify?

You can do this with Shopify Analytics - Shopify's analytics and reporting features give you a view into your store's recent activity, give you insight into your visitors, and analyze online store velocity and store transactions.

  • See the overall health of your store right in your Shopify admin (go to Admin > Analytics).
GA4 x Shopify Tutorial | Shopify Analytics report for your Shopify e-commerce store
  • The Shopify plan requires a subscription to Advanced or Shopify Plus to see unlimited analytics reports.
Analysis and Reporting
(Click the link to view details)
Shopify Lite Shopify Starter/Basic Shopify Shopify Advanced Shopify Shopify Plus
Analysis page โœ“ โœ“ โœ“ โœ“ โœ“
Financial report
(taxes and payments included)
โœ“ โœ“ โœ“ โœ“ โœ“
Product analysis โœ“ โœ“ โœ“ โœ“ โœ“
Live view - โœ“ โœ“ โœ“ โœ“
Customer Development Report - โœ“ โœ“ โœ“ โœ“
Inventory report - โœ“ (5 items out of 7 items) โœ“ โœ“ โœ“
Behavior report - โœ“ (5 items out of 6) โœ“ โœ“ โœ“
Marketing report - โœ“ (1 of 5 total) โœ“ โœ“ โœ“
Order report - - โœ“ โœ“ โœ“
Sales report - - โœ“ โœ“ โœ“
Retail sales report - - โœ“ โœ“ โœ“
Profit report - - โœ“ โœ“ โœ“
Customer report - - โœ“ (7/9) โœ“ โœ“
Custom report - - - โœ“ โœ“

 

๐Ÿ‘‰ If you want to know the latest Shopify tutorials and Shopify Taiwan news, you can follow us - Akohub & AkoCommerce - Taiwan's first Shopify Partner and the only Shopify Plus Partner.
๐Ÿ‘‰ For questions about opening a Shopify store, you are also welcome to fill out this Shopify store consultation form

Shopify Taiwan Success Stories
Back to blogShopify Tutorials