Set up Shopify Google Analytics - Ideal tracking with GA4

Luke

Lukas Schmidt, September 26, 2024

Set up Shopify Google Analytics - Ideal tracking with GA4

Reading time: 7 minutes

Google Analytics and e-commerce go hand in hand, as tracking is essential for online stores. So it's no wonder that Google Analytics has become indispensable for Shopify merchants. So if you haven't set up Google Analytics yet, you'll learn how to do it in this article. But first, let's take a look at what exactly Google Analytics is and how it can help you as a Shopify merchant.

What is Google Analytics?

Google Analytics is a tracking tool provided by Google. By linking it to your Shopify store, you can evaluate various parameters of your website. With GA, you can gain valuable insights into user behavior. Through tracking, your Shopify marketing more targeted, which can lead to more sales.

Here is an overview of the options you have with Google Analytics:

  • - Through which channels do visitors find your Shopify store
  • - How long users stay on your site
  • - On which pages do you lose a lot of users
  • - Which menu items are clicked often
  • - Which channels generate the most sales

The free version is sufficient to obtain the most important data. As a Google service, Google Analytics can also score points with native interfaces to Google Ads, Google Tag Manager and Google Looker Studio. So an integration in Shopify is really always appropriate, unfortunately it is relatively complex, which is why I keep seeing companies that have set up GA incorrectly. I'll walk you through the process below. However, if you get stuck somewhere, I advise you to contact an expert, because you urgently need the right data! It's better to invest some money in your tracking so that everything works.

Universal Analytics and Google Analytics 4

On July 1, 2023, a relatively drastic step was taken in which the third version of Google Analytics was discontinued. Users therefore had to switch to GA4 (Google Analytics 4) in order to continue receiving data. Since then, only Google Analytics 4 has been offered. Some functions have changed. However, Universal Analytics is a relic of the past if you want to integrate Google Analytics into Shopify today. So let's not waste time with that.

Setting up Google Analytics for Shopify - step by step

In order for GA4 to deliver the desired data in Shopify, it is important to set it up correctly. Time and again I see companies that do not have a functioning Google Analytics 4 setup and therefore receive incorrect or incomplete data.

Let's go through the process together, step by step, so that you get sensible data afterwards.

Step #1: Check whether Google Analytics is already active

Before you set up Google Analytics 4 in Shopify, you should make sure that a version of Google Analytics is not already running in your store. A double integration can lead to inaccurate data. If you have not yet set up Google Analytics, skip this step and continue with step 2.

To check whether Google Analytics is already active:

  1. 1. go to "Sales channels" in your Shopify admin dashboard and select the "Online store".
  2. 2. click on "Configurations". Under the "Google Analytics" section, you will either see a field for entering a Google code or the message that GA4 is already linked.
  3. 3. check the code of your theme file: Click on "Themes" under "Sales channels" > "Online store" and select "Edit code". Navigate to the "Layout" section and open the theme.liquid file. Search for older tracking tags such as ga.js, dc.js, gtag.js or analytics.js. If none of these tags are present, you can continue with peace of mind.

💡 Tip: If you find checking the code manually too complicated, you can use the Google Tag Assistant to automatically scan your store for existing tags.

Step #2: Create a Google Analytics 

AccountIf you don't have a Google Analytics account yet, follow these steps:

  1. 1. visit the Google Marketing Platform and sign in with your Google account.
  2. 2. click on "Log in to Analytics" at the top right and click on the gear icon (administration) in the lower left area.
  3. 3. select "Create account" and give your account a name.
  4. 4. under "Create property", enter the name of your website, select the appropriate time zone and the location of your store.

💡 Note: Make sure that the time zone and location details are correct in order to obtain accurate analyses.

Step #3: Create a GA4 property for your Shopify store

A property is an instance in Google Analytics that collects data for a specific website or app. This is how you set it up:

  1. 1. in your Analytics account, navigate to "Administration" and click on "Create property".
  2. 2. Enter a property name (e.g. "MyShop Analytics") and select the location and time zone.
  3. 3. Under "What do you want to track?", select the "Web" option.
  4. 4. Enter the URL of your Shopify store and set up a data stream. The data stream is simply the connection between your website and GA4.
  5. 5. leave standard events active: These predefined events (e.g. page views) can give you valuable insights. You can customize them later.

Step #4: Store the measurement ID in Shopify

After you have created your property, you will receive a unique measurement ID (GA-XXXXXXXXX), which you must insert into Shopify. Here are two options:

Option 1: Insert measurement ID in the Shopify backend

  1. 1. Copy the GA4 measurement ID from your Google Analytics account.
  2. 2. Open your Shopify admin dashboard and go to "Sales channels" > "Online store" > "Configurations".
  3. 3. Scroll to the "Google Analytics" section and click on "Manage pixels here".
  4. 4. Install the Google & YouTube distribution channel if you don't already have it.
  5. 5. Connect your Google account and add the GA4 property.

Option 2: Insert measurement ID via the Google Tag Manager

If you use the Google Tag Manager (GTM), you can also integrate GA4 via it:

  1. 1. copy the measurement ID from your Google Analytics account.
  2. 2. Log in to Google Tag Manager and create a new tag.
  3. 3. Select "Google Analytics: GA4-Event" as the tag type.
  4. 4. Enter your measurement ID in the corresponding field.
  5. 5. Specify which events you want to track (e.g. page views or purchases).
  6. 6. Configure triggers and variables if necessary.
  7. 7. Save and publish the tag to activate tracking.

💡 Tip: The Google Tag Manager is handy if you want to easily add more tracking tags in the future.

Step #5: Verify the tracking

Once you have set up GA4, you should make sure that the data is recorded correctly. Here are a few quick checks:

  1. 1. Google Tag Assistant: Use the Google Tag Assistant plugin to ensure that the GA4 tag is active and correctly integrated.
  2. 2. real-time reports in GA4: Check your Analytics dashboard under "Real-time" to see whether visitors to your store are being recorded.

Using GA4 correctly in Shopify

You should now receive the first data about the user behavior of your visitors. However, in order for GA4 to be used to its full extent, you should connect it with other Google services.

Google Tag Manager (GTM)

With the GTM, you can record user-defined events and interactions such as button clicks, scroll depths, video views or the addition of products to the shopping cart. This data can be sent directly to GA4.

So if you want to create more specific events, you should connect the GTM with Shopify and Google Analytics.

To connect Google Tag Manager with Google Analytics 4 and Shopify, follow these steps:

Step #1: Add Google Tag Manager to Shopify

  1. Go to Google Tag Manager and create an account if you don't already have one.
  2. Create a new container and select "Web" as the type.
  3. Copy the code snippet that GTM gives you.
  4. In Shopify, go to Online Shop > Themes > Actions > Edit code.
  5. Füge den GTM-Code in die Datei theme.liquid unter dem <head>-Tag ein. Speichern.

Step #2: Set up Google Analytics 4 in GTM

  1. 1. open Google Analytics and receive your measurement ID (e.g. G-XXXXXXXXXX).
  2. 2. go to Tags > New in GTM and select "Google Analytics: GA4 configuration tag".
  3. 3. insert your measurement ID.
  4. 4. select "All pages" for triggering so that the tag works everywhere.
  5. 5. publish the tag.

Step #3: Test and finalize

  1. 1. activate the preview mode in GTM to check that everything is working.
  2. 2. publish your changes when everything is in order.

Google Search Console (GSC)

The GSC provides you with a lot of important data that you need for Shopify SEO you need. To get accurate information on organic search terms and landing pages in GA4, you need to link the GSC to GA4. Then you can accurately measure the conversions that come from organic traffic and compare them with other channels.

To link the GSC with GA4, follow these steps:

  1. 1. log in to your Google Analytics account.
  2. 2. go to the property you want to connect to the Google Search Console.
  3. 3. click on "Admin" and then go to the "Property settings" section.
  4. 4. select "Google Search Console link".
  5. 5. click on "Add website".
  6. 6. enter the URL of your website in the corresponding field and click on "Next".
  7. 7. choose a verification method for your website, such as setting up a DNS record or uploading an HTML file to your website.
  8. 8. confirm your website according to the selected method and click on "Confirm".

Google Ads

The situation is similar with Google Ads tracking in order to track the success of the Shopify Google Ads with other Chanels, your Ads account should also be linked to GA5.

To link Google Analytics 4 with Google Ads, proceed as follows:

  1. 1. log in to your Google Analytics 4 account.
  2. 2. tap on the gear icon in the bottom left-hand corner to access the settings.
  3. 3. select the property you want to connect to Google Ads.
  4. 4. click on "Google Ads link" and then on "Create link".
  5. 5. select the Google Ads accounts you want to link and press "Next".
  6. 6. set the settings for how long the link should be active and click on "Create link".

Conclusion - Google Analytics is mandatory for all Shopify merchants

As an e-commerce merchant, you need Google Analytics for your Shopify store. The data you get from the right setup is exactly what you need to plan and monitor your marketing efforts. Setting it up correctly can be a bit complex and frustrating. That's why, in my opinion, it makes the most sense to hire an expert. However, if you want to try it yourself, I hope my guide will walk you through the necessary steps.

FAQ

What is the difference between Google Analytics 4 and Universal Analytics for my Shopify store?

Google Analytics 4 ( GA4 for short) is the latest version of Google Analytics and offers improved features for analyzing user behavior. Unlike Universal Analytics, which focuses on sessions and page views, GA4 focuses more on events and provides a more comprehensive view of the user journey. These changes are particularly relevant for e-commerce stores, as they enable a more precise analysis of conversions and sales. Therefore, it is important to set up GA4 in Shopify to benefit from these new features.

How can I set up Google Analytics in Shopify?

To set up Google Analytics in your Shopify store, you need to create a Google Analytics account if you don't already have one. Then go to the settings of your Shopify store and select "Online Shop" and then "Settings". Here you can paste the tracking code from GA4 into the appropriate field. Make sure you activate e-commerce tracking to gain important insights.

What are the benefits of using Google Analytics 4 for e-commerce?

Google Analytics 4 offers numerous benefits for e-commerce businesses, including improved tracking of conversions, detailed analysis of user behavior and the ability to monitor different channels. By integrating GA4, you can better understand how users interact with your online store, which products are most popular and where optimization is needed. This data is crucial for optimizing your marketing strategies.

Luke

Luke Schmidt

Senior SEO Consultant

As an SEO expert and content marketing manager, Lukas successfully increases the visibility of our clients in Google. He shares his in-depth knowledge of online marketing, SEO, e-commerce and Shopify on the Golden Web Age blog.

Do you need support for a project?
Book a free initial consultation now