How to Set up Google Analytics on Shopify [4 Methods Explained]
Tags: webdev, tutorial, analytics, shopify
Published: 2022-12-12 14:40:13

Ever since I started to work with Shopify clients, I realized they all have problems with their Shopify Google Analytics integration. 

They either didn’t know how to set up Google Analytics on Shopify completely or they had discrepancies with their data. Their data simply wouldn’t match, or it wasn’t reliable. 

It all comes down to setup methods and mistakes during the setup process on Shopify Admin and Google Analytics. 

In this post, I will show you how to set up Google Analytics on your Shopify store and start tracking important metrics like traffic, conversions, and sales. There are a couple of alternative options for setup, and I’ll touch base with each of them so you can make your own choice. 

After setting it correctly, you can make data-driven decisions to grow your business and provide a better experience for your customers. Let's get started!

## GA4 vs. Universal Analytics - Which is better for Shopify?
The short answer is both! You should be using both of the Google Analytics versions. The reason is simple, Universal Analytics is going away, and the data won’t be carried over to GA4. And Google Analytics 4 will be the only active version. 

If you want to know the differences, you can check out my other post: [Universal Analytics vs. Google Analytics 4 Explained for Shopify Merchants](https://dev.to/gloriamaldonado/universal-analytics-vs-google-analytics-4-explained-for-shopify-merchants-32fh) 

**Here is a summary:** 
GA4 is the latest version of Google Analytics and introduces several new features and improvements over Universal Analytics. Some of the key advantages of GA4 include the ability to track events and user interactions in more detail, improved integration with other Google products like Google Ads, and a more user-friendly interface. Additionally, GA4 has a stronger focus on privacy and security, and provides more data protection options for users.

On the other hand, Universal Analytics is a well-established and widely used version of Google Analytics many third-party tools and integrations support that. It has a robust feature set and is suitable for a wide range of uses, from simple tracking to more advanced analysis. Universal Analytics also allows for greater customization and can be used to track more complex data.

### Setup Method 1: Shopify Google Analytics Native Integration 
Shopify has a native Google Analytics integration under the Shopify Admin > Online Store > Preferences. However, it only supports Universal Analytics, the old version as of now. 

Here is how it looks like in the Shopify admin panel. You simply need to copy your Universal Analytics measurement ID and paste here and then it will work. Here are the steps for setting up Google Analytics on Shopify using the native integration. 

![Shopify Google Analytics Native Integration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pdhmfksx5rjzt449luzg.png)

**Step 1:** In your Shopify admin, go to Online Store > Preferences.
**Step 2:** Scroll down to the Google Analytics section, and click the checkbox next to Use Google Analytics.
**Step 3:** In the Google Analytics account field, enter the Google Analytics tracking ID that you obtained when creating your Google Analytics account. This is typically in the format of UA-XXXXXXX-XX.
**Step 4:** Click Save to apply the changes.
**Step 5:** You can verify that the setup was successful by checking your Google Analytics account. The Shopify data should appear in the Real-Time > Overview report.

#### When will Shopify support Google Analytics 4?

The official announcement below shows that Shopify will support Google Analytics 4 in March 2023. You need to use the alternative setup methods until then. Please check Method 2 and Method 3 below. 

![When will Shopify support Google Analytics 4?](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8v35qi9p650bd13agf3.png)

### Setup Method 2: Shopify GA4 Kit
As recommended above, you should set up Google Analytics 4 before it is too late so that you can start collecting data. 

There is an excellent open-source solution called Shopify GA4 Kit. The Shopify GA4 Kit is built by Shopify app developers, and it allows merchants to easily set up and use Google Analytics 4 (GA4) on their store. It provides a streamlined way to set up GA4, track key events on your store, and view reports in the Shopify admin. This makes it easy to get started with GA4 and start tracking important metrics like traffic, conversions, and sales without having to configure the tracking code or use additional tools manually.

The Shopify GA4 Kit is an open-source solution and is available to all Shopify users. The Shopify Google Analytics setup process is: 

**Step 1:** [Visit the Shopify GA4 Kit page on Github](https://github.com/analyzify/shopify-ga4-kit) and download the Google Tag Manager container. 
**Step 2:** Copy the Shopify data layers and paste them into the theme.liquid and thank you page additional scripts. 
**Step 3:** Paste your GA4 measurement ID into the GTM container’s relevant section. 
**Step 4:** Test the whole setup using Google Tag Manager preview mode. 
**Step 5:** Verify the setup using Google Analytics 4 Debug View. 
**Step 6:** Publish all the changes and activate the GA4 Kit on your Shopify store. 

Once enabled, the GA4 Kit will automatically track key events on your stores, such as product views, add-to-cart events, and checkout completions. You can view the GA4 reports in the Shopify admin or connect your GA4 account to the Google Analytics website to access more advanced features and analysis.

Overall, the Shopify GA4 Kit makes it easy for Shopify users to set up and use GA4 on their store, and provides valuable insights into their store's performance and customer behavior.

### Setup Method 3: Shopify Analytics Apps
You should use professional Shopify Google Analytics apps for the best results. There are 100+ apps in this category. View my other relevant post where I deep-dived into the relevant topic: [Top Google Analytics Apps for Your Shopify Store](https://dev.to/gloriamaldonado/top-google-analytics-apps-for-your-shopify-store-45fn) 

![Shopify Analytics Apps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xc52ifbu4fr04yj1e0ne.png)

Using a Shopify Google Analytics app can provide several benefits for your store. Some of the reasons to use a Shopify Google Analytics app include:

1. **Professional setup support:** Apps like Analyzify offers a Done-For-You setup option where the experts handle the setup for you. In this way, you don’t risk your data connections. 
2. **Improved tracking and reporting:** A Shopify Google Analytics app can provide more detailed tracking and report for your store beyond what is available with the default Shopify GA4 Kit. This can include tracking custom events, tracking user behavior on specific pages, and more.
4. **Enhanced analysis and insights:** A Shopify Google Analytics app can provide advanced analysis and insights into your store's performance, such as customer segmentation, funnel analysis, and more. This can help you better understand your customers and make data-driven decisions to improve your store.
6. **Integration with other tools:** Many Shopify Google Analytics apps can integrate with other tools, such as marketing and advertising platforms, email marketing tools, and more. This can provide a more comprehensive view of your store's performance and help you optimize your marketing efforts.
8. **Ease of use:** Shopify Google Analytics apps are designed to be easy to use, and often provide a user-friendly interface that makes it easy to access and analyze the data. This can save you time and effort compared to manually configuring tracking and analysis.

Overall, using a Shopify Google Analytics app can provide valuable insights into your store's performance and help you make data-driven decisions to grow your business.

### Setup Method 4: Set GA4 up Using Shopify Pixels
Shopify recently launched a new feature: Shopify Customer Events. This video and article walks you through this method and helps you set up GA4 on Shopify using Shopify Pixels. 

{% youtube m2lw2ET9Uf4 %}

Shopify customer events are a feature of the Shopify platform that allows you to track specific actions taken by customers on your store. These events can be triggered by various actions, such as viewing a product, adding an item to the cart, or completing a purchase. By tracking customer events, you can gain valuable insights into your customers' behavior and use this information to improve your store's performance. Custom customer events can provide even more detailed insights into your customers' behavior and can be used to optimize your store's performance.

### Conclusion & Action Plan

> As you can see, there are many methods for setting up GA on your Shopify store. I tried to cover all the important methods. 

My humble recommendation is: 

- Use Shopify’s native integration for Universal Analytics
- Set up Google Analytics 4 using Shopify GA4 Kit
- Purchase professional apps/services if you have budget.

After setting up Google Analytics, make sure to use it for analyzing your store’s performance. 

**Resources:** 
1. [https://apps.shopify.com/search?q=google%20analytics%204](https://apps.shopify.com/search?q=google%20analytics%204)
2. [https://help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-analytics-4](https://help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-analytics-4) 
3. [https://support.google.com/analytics/answer/10089681?hl=en](https://support.google.com/analytics/answer/10089681?hl=en)
4. [https://www.linkedin.com/pulse/set-up-google-analytics-4-shopify-using-pixels-analyzify/](https://www.linkedin.com/pulse/set-up-google-analytics-4-shopify-using-pixels-analyzify/)