Setting up Shopify Google Analytics – Optimal tracking with GA4

Lukas Schmidt, 26 September 2024

Setting up Shopify Google Analytics – Optimal tracking with GA4

Google Analytics and e-commerce go hand in hand, as tracking is essential for online shops. So it’s no wonder that Google Analytics has become indispensable for Shopify merchants too. If you haven’t set up Google Analytics yet, this article will show you how. But first, let’s take a look at exactly what 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 shop, you can analyse various aspects of your website. With GA, you can gain valuable insights into user behaviour. Tracking allows you to make your Shopify marketing more targeted, which can lead to increased turnover.

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

  • Through which channels do visitors find their way to your Shopify shop?
  • How long do users stay on your site?
  • On which pages do you lose a lot of users?
  • Which menu items are clicked on most often?
  • Which channels generate the most revenue?

The free version is sufficient for obtaining the most important data. Furthermore, as a Google service, Google Analytics offers native interfaces to Google Ads, Google Tag Manager and Google Looker Studio. Integration with Shopify is therefore always a good idea, but unfortunately it’s relatively complex, which is why I keep seeing companies that have set up GA incorrectly. I’ll walk you through the process step by step below. However, if you get stuck at any point, I’d advise you to contact an expert, as you urgently need accurate data! It’s better to invest a bit of money in your tracking once and for all to ensure everything works properly.

Universal Analytics and Google Analytics 4

On 1 July 2023, a relatively drastic step was taken, with the third version of Google Analytics being phased out. This meant that users had to switch to GA4 (Google Analytics 4) in order to continue receiving data. Since then, only Google Analytics 4 has been available. Some of the way it works has changed. However, Universal Analytics is a thing of the past if you want to integrate Google Analytics into Shopify today. So let’s not waste any time on it.

Setting up Google Analytics for Shopify – step by step

To ensure that GA4 in Shopify can provide the data you need, it is important to set it up correctly. Time and again, I come across businesses that do not have a working Google Analytics 4 setup and therefore receive incorrect or incomplete data.

Let’s go through the process step by step together so that you end up with reliable data.

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 isn’t already running in your shop. Having two integrations can lead to inaccurate data. If you haven’t set up Google Analytics yet, skip this step and continue with step 2.

Here’s how to check whether Google Analytics is already active:

  • 1. In your Shopify admin dashboard, go to ‘Sales channels’ and select ‘Online shop’.
  • 2. Click on ‘Configurations’. Under the ‘Google Analytics’ section, you will either see a field for entering a Google code or a message stating that GA4 is already linked.
  • 3. Check the code in your theme file: Under ‘Sales channels’ > ‘Online shop’, click ‘Themes’ and select ‘Edit code’. Navigate to the ‘Layout’ section and open the theme.liquid file. Look for older tracking tags such as ga.js, dc.js, gtag.js or analytics.js. If none of these tags are present, you can carry on without any concerns.

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

Step #2: Set up a Google Analytics account

If you don’t yet have a Google Analytics account, follow these steps:

  • 1. Go to the Google Marketing Platform and log in with your Google account.
  • 2. Click on ‘Sign in to Analytics’ in the top right-hand corner and go to the cog icon (Administration) in the bottom left-hand corner.
  • 3. Select ‘Create account’ and give your account a name.
  • 4. Under ‘Create property’, enter the name of your website, select the correct time zone and the location of your shop.

💡 Note: Make sure that the time zone and location details are correct to ensure you get accurate analyses.

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

A property is an instance in Google Analytics that collects data for a specific website or app. Here’s how to set it up:

  • 1. In your Analytics account, go to ‘Administration’ and click on ‘Create property’.
  • 2. Enter a property name (e.g. ‘MyShop Analytics’) and select the location and time zone.
  • 3. Under ‘What would you like to track?’, select the ‘Web’ option.
  • 4. Enter the URL of your Shopify shop and set up a data stream. The data stream is simply the connection between your website and GA4.
  • 5. Keep standard events enabled: These predefined events (e.g. page views) can provide you with valuable insights. You can customise them later.

Step #4: Enter the measurement ID in Shopify

Once you have created your property, you will be given a unique tracking ID (GA-XXXXXXXXX), which you will need to enter into Shopify. Here are two options:

Option 1: Add the measurement ID in the Shopify admin

  • 1. Copy the GA4 measurement ID from your Google Analytics account.
  • 2. Open your Shopify admin dashboard and go to ‘Sales channels’ > ‘Online shop’ > ‘Configurations’.
  • 3. Scroll down to the ‘Google Analytics’ section and click on ‘Manage pixels here’.
  • 4. Install the Google & YouTube sales channel if you haven’t already.
  • 5. Link your Google Account and add the GA4 property.

Option 2: Insert the tracking ID via Google Tag Manager

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

  • 1. Copy the property ID from your Google Analytics account.
  • 2. Log in to Google Tag Manager and create a new tag.
  • 3. Select ‘Google Analytics: GA4 Event’ as the tag type.
  • 4. Enter your measurement ID in the relevant field.
  • 5. Decide which events you want to track (e.g. page views or purchases).
  • 6. Configure triggers and variables if necessary.
  • 7. Save and publish the tag to enable tracking.

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

Step #5: Verify the tracking

Once you’ve set up GA4, you should make sure that the data is being collected correctly. Here are a few quick checks:

  • 1. Google Tag Assistant: Use the Google Tag Assistant plugin to ensure that the GA4 tag is active and correctly implemented.
  • 2. Real-time reports in GA4: Check the ‘Real-time’ section of your Analytics dashboard to see if visitors to your shop are being tracked.

How to use GA4 correctly in Shopify

You should now start to receive the first data on your visitors’ behaviour. However, to get the most out of GA4, you should link it to other Google services.

Google Tag Manager (GTM)

With GTM, you can track custom events and interactions such as button clicks, scroll depths, video views or the addition of products to the shopping basket. This data can be sent directly to GA4.

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

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

Step #1: Add Google Tag Manager to Shopify

  • Go to Google Tag Manager and create an account if you don’t already have one.
  • Create a new container and select ‘Web’ as the type.
  • Copy the code snippet provided by GTM.
  • In Shopify, go to Online Shop > Themes > Promotions > Edit code.
  • Paste the GTM code into the theme.liquid file below the <head> tag. Save.

Step #2: Set up Google Analytics 4 in GTM

  • 1. Open Google Analytics and note down your tracking ID (e.g. G-XXXXXXXX).
  • 2. In GTM, go to Tags > New and select ‘Google Analytics: GA4 configuration tag’.
  • 3. Enter your measurement ID.
  • 4. Under ‘Triggering’, select ‘All pages’ so that the tag works everywhere.
  • 5. Publish the tag.

Step #3: Test and finalise

  • 1. Enable preview mode in GTM to check that everything is working.
  • 2. Publish your changes once everything is in order.

Google Search Console (GSC)

GSC provides you with a lot of important data that you need for Shopify SEO. To obtain accurate information on organic search terms and landing pages in GA4, you need to link GSC to GA4. You can then accurately measure conversions generated by organic traffic and compare them with other channels.

To link GSC to GA4, follow these steps:

  • 1. Log in to your Google Analytics account.
  • 2. Go to the property you want to link to Google Search Console.
  • 3. Click on ‘Admin’ and then go to the ‘Property settings’ section.
  • 4. Select ‘Google Search Console link’.
  • 5. Click on ‘Add website’.
  • 6. Enter your website’s URL in the relevant field and click ‘Next’.
  • 7. Select a verification method for your website, such as setting up a DNS record or uploading an HTML file to your website.
  • 8. Verify your website using the method you have chosen and click ‘Verify’.

Google Ads

The situation is similar with Google Ads tracking: to be able to compare the performance of your Shopify Google Ads campaigns with other channels, you should also link your Ads account to GA4.

To link Google Analytics 4 to Google Ads, follow these steps:

  • 1. Log in to your Google Analytics 4 account.
  • 2. Tap the cog icon in the bottom-left corner to access the settings.
  • 3. Select the property you want to link to Google Ads.
  • 4. Click on ‘Google Ads link’ and then on ‘Create link’.
  • 5. Select the Google Ads accounts you want to link and click ‘Next’.
  • 6. Set the options to specify how long the link should remain active, then click on ‘Create link’.

Conclusion – Google Analytics is a must for all Shopify merchants

As an e-commerce retailer, you need Google Analytics for your Shopify shop. The data you’ll get from setting it up correctly is exactly what you need to plan and monitor your marketing activities. 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 for this. However, if you’d like 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 shop?

Google Analytics 4 (GA4 for short) is the latest version of Google Analytics and offers enhanced features for analysing user behaviour. Unlike Universal Analytics, which focuses on sessions and page views, GA4 places greater emphasis on events and provides a more comprehensive view of the user journey. These changes are particularly relevant for e-commerce shops, as they enable a more precise analysis of conversions and revenue. It is therefore 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 shop, you’ll need to create a Google Analytics account if you don’t already have one. Next, go to your Shopify store’s settings, select ‘Online Shop’ and then ‘Settings’. Here, you can paste the GA4 tracking code into the relevant field. Make sure you enable e-commerce tracking to gain valuable 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 conversion tracking, detailed analysis of user behaviour and the ability to monitor various channels. By integrating GA4, you can gain a better understanding of how users interact with your online shop, which products are most popular and where there is room for improvement. This data is crucial for optimising your marketing strategies.

Lukas Schmidt

Senior SEO Consultant

As an external SEO and content marketing consultant, Lukas helps Golden Web Age’s clients to strategically boost their visibility on Google. As a freelance expert, he publishes in-depth articles on online marketing, SEO, e-commerce and Shopify on the Golden Web Age blog.

Do you need help with a project?
Book a free initial consultation now