Skip to main content

How to Add Google Analytics to Shopify (Beginner Friendly Guide)

| Admin | ,

If you want to learn how to add Google Analytics to Shopify, this guide will walk you through the process in a clear and beginner-friendly way. Google Analytics 4 helps you understand where your visitors come from, how they move through your store, and which products lead to sales. 

Here are the key points you will learn in this guide:

By the end of this guide, you will have a complete and reliable GA4 setup for your Shopify store, along with the confidence to read your data and improve your store’s performance. Let’s begin.


Why Add Google Analytics to Shopify

Many merchants ask how do I add Google Analytics to my Shopify store, because Google Analytics plays an important role in understanding how visitors interact with your store.

What is Google Analytics 4

Google Analytics 4 is a tracking tool that helps you understand how people find and use your Shopify store. It collects data about page views, traffic sources, customer behavior, product interactions, and purchases. GA4 uses an event-based model, so every action a visitor takes can be measured and analyzed in more detail.

How GA4 works with Shopify

Google Analytics connects to your Shopify store through a tracking tag. After you install GA4, Shopify sends events to your Google Analytics property. These events show what customers do in your store, such as viewing a product, adding an item to the cart, starting checkout, or completing an order. 

This gives you a complete picture of your customer journey from the first click to the final purchase.

Why you should add Google Analytics before you start selling

Adding Google Analytics early helps you collect clean data from the moment your store receives its first visitors. Accurate tracking allows you to:

  • See where your customers come from
  • Measure the performance of your products and collections
  • Understand cart and checkout behavior
  • Improve your marketing and ad campaigns
  • Identify what drives conversions and what blocks them
  • Make better decisions for store design, content, and promotions

A correct GA4 setup gives you the insights you need to grow your Shopify store with confidence.


What You Need Before You Add Google Analytics to Shopify

Before you set up Google Analytics 4, make sure the following items are ready. This helps you avoid tracking errors and keeps your data clean from the start.

RequirementReasons
Google accountYou must sign in with a Google account. If you use Gmail or any Google service, you can use the same login.
GA4 propertyCreate a Google Analytics 4 property and a web data stream. Save the Measurement ID that starts with G.
A live Shopify storeYour store should be on a live domain and not protected by a password if you want real tracking data.
Primary domain setMake sure your main domain is active. This prevents duplicate or incorrect traffic sources.
Chosen setup methodDecide if you will use the Google and YouTube app, Google Tag Manager, the gtag script, or a tracking app.
Access to Shopify adminYou need permission to install apps or edit settings inside Shopify.

With these items in place, you can start adding Google Analytics to Shopify without missing any key steps.


How to Add Google Analytics to Shopify Using Google and YouTube App

The Google and YouTube app is the simplest and most reliable way to install Google Analytics 4 on your Shopify store. It is supported by Shopify and Google, and it sends key eCommerce events to GA4 without extra setup.

  • Pros: easiest setup, official support, automatic eCommerce events
  • Cons: limited event detail for advanced tracking, fewer custom options

Before you start, make sure your Shopify store meets all requirements shown inside the app. Shopify displays these requirements automatically after installation.

Step 1. Install the Google and YouTube Sales Channel

This step adds the official Google app to your Shopify store so you can connect your Google accounts and begin the GA4 setup.

google and youtube app
  1. Sign in to your Shopify admin and go to the Shopify App Store.
  2. Search for Google and YouTube.
  3. Click Install and approve the permissions.
  4. Review the setup requirements shown inside the app and make any needed changes.
  5. Connect your Google account when asked.
2 connect to ga4

After installation, the Google and YouTube app appears under your Sales Channels list.

Step 2. Connect your GA4 property to Shopify

Here you link your store to your Google Analytics 4 property using Shopify’s guided setup.

  1. Open Sales channels in your Shopify admin.
  2. Select Google and YouTube.
  3. Look for the banner that says Looking only to set up Google Analytics 4.
  4. Click Get started.
  5. Choose your GA4 property from the dropdown or create a new one.
  6. Confirm the correct web data stream.
  7. Click Connect to complete the link.

Shopify now sends your store data to the GA4 property you selected.

Step 3. Confirm your Google tag and eCommerce events

This step ensures your store has the Google tag installed and that key events are tracked.

  • The Google and YouTube app installs the tag for you.
  • No theme edits or code changes are required.
  • Shopify automatically sends standard eCommerce events to GA4, including page views, product views, add to cart, begin checkout, and purchases.

For a complete list of automatic events, Shopify directs merchants to Google’s GA4 documentation.

Important: GA4 does not track events until password protection is removed from your online store.

Step 4. Test that GA4 is working

Now, you can verify that your store is sending data to Google Analytics correctly.

  1. Open your online store in a new tab.
  2. View a few pages and add a product to the cart.
  3. Go to your GA4 property.
  4. Open Realtime to check for your active visit.
  5. Open DebugView if you want detailed event activity.
ga4 connect how to add google analytics to shopify

If your actions appear inside GA4, your setup is complete.


How to Add Google Analytics to Shopify with Google Tag Manager (Advanced)

Shopify Google Tag Manager gives you full control over tracking tags and is useful for stores that need custom events or multiple marketing pixels. This method is technical and requires JavaScript knowledge because Shopify does not support GTM by default. You must use a Custom Pixel to connect Shopify events to GTM.

  • Good for: multiple marketing tags, custom events, advanced tracking setups 
  • Risks: duplicate tracking if you use it at the same time as the Google and YouTube GA4 integration

Shopify recommends the Google and YouTube app for most merchants. GTM should be used only if you need a custom solution.

Step 1. Set up your GTM container

This step prepares your Google Tag Manager container and connects it to your Shopify store through a Custom Pixel. This is the required method on Shopify.

  • Open your Google Tag Manager account.
  • Go to Admin.
  • Click Install Google Tag Manager.
  • Copy the head code snippet.
  • Remove the <script> tags so only the JavaScript remains.
google tag manager script
  • In Shopify, open Settings.
  • Select Customer events.
  • Click Add custom pixel.
  • Name your pixel and paste the JavaScript code into the code editor.
  • Save your Custom Pixel.

You now have your GTM container linked to your store. This method does not allow full GTM features because the Custom Pixel runs in a safe sandbox.

Step 2. Add GA4 in GTM

This step adds the GA4 configuration tag inside your GTM container.

  • Open your GTM workspace.
  • Create a new tag.
google tag
  • Choose GA4 Configuration.
  • Enter your Measurement ID.
  • Set the trigger to All Pages.
  • Publish the container.

This tag tracks page views, but it does not track eCommerce events until you push events from Shopify.

Step 3. Send Shopify events to GA4 through the data layer

This is the most technical step. Shopify does not send eCommerce events to GTM automatically. You must subscribe to Shopify events using the Web Pixels API, which acts like a Shopify analytics API, and push them to the GTM data layer.

You can create or edit your Custom Pixel and add event subscriptions like this:

1. Product viewed example

analytics.subscribe("product_viewed", (event) => {

  window.dataLayer = window.dataLayer || [];

  window.dataLayer.push({

    event: "product_viewed",

    product_title: event.data.productVariant.title,

    product_id: event.data.productVariant.id

  });

});

2. Add to cart example

analytics.subscribe("product_added_to_cart", (event) => {

  window.dataLayer.push({

    event: "add_to_cart",

    product_id: event.data.productVariant.id

  });

});

3. Checkout started example

analytics.subscribe("checkout_started", (event) => {

  window.dataLayer.push({

    event: "begin_checkout"

  });

});

4. Purchase example

analytics.subscribe("checkout_completed", (event) => {

  window.dataLayer.push({

    event: "purchase",

    order_id: event.data.checkout.orderId,

    value: event.data.checkout.totalPrice.amount

  });

});

Inside GTM, you create matching GA4 Event tags for each event name you push. This step is complex and usually handled by a Shopify Partner or analytics specialist.

Step 4. Test and avoid double tracking

Testing confirms that your GTM setup works and that GA4 receives events only once.

  1. Open GTM Preview mode.
  2. Perform actions on your store.
  3. Confirm that only your GTM events fire.
  4. Open GA4 Realtime and DebugView to check event delivery.
  5. Remove the Google and YouTube GA4 integration if you use GTM for all tracking.
  6. Delete any manual gtag scripts to prevent duplicates.

A correct test flow ensures clean, accurate reporting.


How to Add Google Analytics to Shopify Using Top Tracking Apps

Some Shopify merchants use tracking apps to strengthen their Google Analytics setup, improve data accuracy, or collect events that the default Shopify integration does not provide. These apps are helpful for stores with advanced tracking needs, subscription products, multi channel ads, or server side tracking.

Below are reliable apps that support GA4 and advanced analytics features. The Google and YouTube app is still the recommended method for basic GA4 installation.

1. Elevar Conversion Tracking

Pricing: Free to install, paid plans start around $200 per month.

Elevar offers one of the most complete tracking solutions for Shopify. Many stores use it to improve data accuracy for GA4 and paid ads.

elevar

Good for:

  • Stores that run paid ads at scale
  • Merchants who need server side tracking
  • Teams that use Google Tag Manager
  • Stores that want more consistent event data

Key features:

  • GA4 support
  • Server side tracking
  • Automatic eCommerce events
  • Google Tag Manager integration
  • Error monitoring
  • Prebuilt tracking templates

2. Littledata – The Data Layer

Pricing: Starts at $99 per month or a Flex plan billed per order.

Littledata is popular among merchants with subscription products or more complex checkout flows.

little data

Good for:

  • Stores using Recharge or other subscription apps
  • Merchants who want very clear product and checkout events
  • Businesses that need server side tracking for GA4

Key features:

  • GA4 support
  • Automatic event mapping
  • Subscription event tracking
  • Clean purchase and checkout data
  • Simple GA4 connection

3. Analyzely – Google Analytics 4

Pricing: Free plan | Pro plan start at $21/month

Analyzely focuses on easier GA4 installation and more accurate event tracking. It offers both client side and server side event collection and includes a built-in analytics dashboard.

analyzely

Good for:

  • Merchants who want a no-code GA4 setup
  • Stores that need server side purchase tracking
  • Teams that want built-in dashboards
  • Merchants that want GDPR-friendly tracking

Key features:

  • Seamless GA4 integration with no coding
  • Server side and client side event tracking
  • Ecommerce event tracking
  • In-app analytics dashboard
  • GDPR friendly controls
  • AI analysis features

Apps provide helpful tracking tools, but the Google and YouTube app remains the simplest and most accurate method for standard GA4 installation.


Shopify sends core eCommerce events to Google Analytics 4 after you complete the setup through the Google and YouTube app. You can improve your data quality inside Google Analytics with a few additional settings. These adjustments follow GA4 best practices and help you read your Shopify reports more clearly.

1. Set up core conversions in GA4

GA4 allows you to mark important events as conversions. This helps you measure the actions that matter most on your Shopify store.

Common eCommerce conversions include:

  • purchase
  • begin_checkout
  • add_to_cart
  • view_item

To mark an event as a conversion:

  1. Open Google Analytics.
  2. Go to Admin.
  3. Select Events.
  4. Turn on the conversion switch for the events you want to track.

Shopify confirms that eCommerce events are tracked automatically after GA4 setup.

2. Configure referral exclusions

Unexpected referral sources sometimes appear when payment gateways or checkout pages interrupt the customer path. GA4 allows you to exclude these sources to keep your reports clean.

Common exclusions include:

  • Your primary domain
  • checkout.shopify.com
  • shop.app
  • Payment providers such as paypal.com

To add exclusions:

  1. Open your GA4 data stream.
  2. Select Configure tag settings.
  3. Add unwanted domains to the referral exclusion list.

This setting is managed inside Google Analytics, not Shopify.

Shopify confirms that linking your GA4 property to your Google Ads account helps you measure key events and build audiences.

full google app settings

This connection improves the accuracy of your ads reporting and is the core step for anyone asking how to add Google Ads tag to Shopify in a clean and trackable way.

To link:

  • Go to Google Analytics.
  • Open Admin.
  • Select Google Ads Linking.
  • Choose your Google Ads account.
  • Complete the connection.

This connection helps you understand ad performance and import conversions into Google Ads.

4. Check data retention, timezone, currency

Correct property settings help you compare GA4 reports with the data you see inside Shopify.

You should check the following:

  • Timezone matches your Shopify store
  • Currency matches your store’s currency
  • Data retention is set to the longest option available

You can adjust these in the GA4 property settings.

5. Enable enhanced measurement (optional)

Enhanced measurement collects extra interactions such as scroll depth, outbound clicks, and site searches without extra coding.

ads account setup

To enable it:

  1. Go to your GA4 data stream.
  2. Turn on the enhanced measurement toggle.
  3. Select the interactions you want to track.

Shopify references Google’s documentation for enhanced measurement, as these settings are controlled inside GA4.


Common Problems When Adding Google Analytics to Shopify (And How to Fix Them)

Google Analytics 4 is reliable once it is set up correctly, but merchants often run into a few issues when tracking starts. These problems are common and usually have simple solutions. The points below match Shopify’s official documentation and real troubleshooting cases.

1. Google Analytics 4 is not tracking any data

GA4 may show no activity if your Shopify store is still locked behind password protection or if your tag is not connected correctly.

What to check:

  • Your store is not password protected
  • You installed the Google and YouTube app correctly
  • You connected the right GA4 property
  • Your Measurement ID matches the one in your GA4 property
  • You are testing on your live domain

How to fix:

  1. Remove password protection.
  2. Confirm the correct data stream in the Google and YouTube app.
  3. Check GA4 Realtime to see if your visit appears.
  4. Clear your browser cache and test again.

2. Numbers don’t match between Shopify and GA4

Shopify and Google Analytics will never match exactly. Both platforms use different tracking systems and collect data in different ways. This difference is documented by Shopify and is expected.

Possible causes:

  • GA4 uses an attribution model that counts conversions by channel
  • Shopify counts every purchase by the final checkout
  • Customers block cookies or JavaScript
  • GA4 filters out internal traffic
  • Timezone or currency differences

How to fix:

  1. Align your timezone and currency between Shopify and GA4.
  2. Check if your browser blocks cookies or tracking.
  3. Compare longer time ranges instead of single days.
  4. Review attribution settings in GA4 for more context.

Small differences are expected, but large gaps often indicate a tracking issue.

3. Duplicate pageviews or conversions

Duplicate events happen when more than one Google Analytics setup is active on your store.

Common reasons:

  • You added GA4 with the Google and YouTube app and also added GTM
  • Old tracking scripts still exist in theme files
  • Gtag was added manually before using the Google and YouTube app

How to fix:

  1. Use only one method for GA4 tracking.
  2. Remove any gtag or GA scripts from theme.liquid.
  3. If you use GTM, turn off GA tracking inside the Google and YouTube app.
  4. Test your events in GA4 DebugView to confirm a single event per action.

Shopify warns that using multiple GA4 methods results in duplicate events.

4. Missing or incomplete eCommerce events

If events like add to cart, begin checkout, or purchase do not appear, Shopify may not be sending the correct event data.

Possible causes:

  • GA4 property not linked correctly
  • An incomplete setup inside the Google and YouTube app
  • Custom theme code blocking event scripts
  • Tracking apps overriding default events

How to fix:

  1. Reconnect your GA4 property inside the Google and YouTube app.
  2. Test your store in GA4 DebugView to see which events fire.
  3. Remove any custom scripts that may override Shopify events.
  4. If you use GTM or a tracking app, check their event mapping.

Shopify confirms that standard eCommerce events are tracked automatically after GA4 setup, so missing events usually signal a setup conflict.


How to Add Google Analytics to Shopify: FAQs

How to integrate Google with Shopify?

You can integrate Google with Shopify by installing the Google and YouTube app from the Shopify App Store. After installation, connect your Google account and select your GA4 property. Shopify handles the tracking tag for you, so no manual code is needed.

How do I add Google Analytics tracking to a website?

To add Google Analytics tracking to any website, you need to copy your GA4 Measurement ID and place your gtag script inside the HTML head. On Shopify, this happens automatically when you use the Google and YouTube app.

How do I add a tracking code to Shopify?

You can add a tracking code to Shopify in three main ways: use the Google and YouTube app, add your gtag script inside a Custom Pixel or install your tracking code through Shopify Google Tag Manager using a Custom Pixel container. The Google and YouTube app is the easiest and most accurate option for most merchants.

Does Shopify have built-in analytics?

Yes. Shopify includes built-in analytics that show sales, traffic, sessions, conversion rate, top products, and customer behavior. These reports are helpful for understanding store activity, but they are not as detailed as Google Analytics.


Final Thoughts

Google Analytics 4 gives you a clear view of how customers find your Shopify store and what leads them to purchase. A correct setup provides reliable data that helps you make better marketing and product decisions. Choose the setup method that suits your skill level, test your tracking, and use your insights to improve your store experience over time.

Build a Shopify store that looks professional and feels easy to use!

At LitOS, our team helps merchants set up and design Shopify stores that look clean and function smoothly. From layout planning and theme setup to a complete launch ready design, we make sure your store has a strong foundation and a user friendly experience from day one.

Contact Us

Let’s create something great

We have a reasonable rating system that fits every budget. If you’re just starting out, we can help you create your digital brand, work out a strategy for you and help you grow. And if you have a strong brand – we can help you grow it to be even stronger. Contact us. We would love to meet you.