How to Install Google Analytics 4 on Shopify
Connecting Google Analytics 4 to your Shopify store is a foundational step to truly understanding how customers find and interact with your brand. While Shopify has good built-in analytics, GA4 offers a much deeper, more holistic view of your entire customer journey. This guide will walk you through setting up GA4 on your Shopify store, verifying that it’s working correctly, and configuring a few essential settings to start collecting clean, useful data.
Why Connect GA4 to Your Shopify Store Anyway?
You might be wondering why you need GA4 when Shopify already provides reports on sales, traffic sources, and conversion rates. Think of Shopify’s analytics as a great summary of what happens inside your store. GA4, on the other hand, helps you understand the bigger picture of how people get there and what they do across their entire journey, even before and after they land on your site.
Here are a few quick benefits:
- See the Full Funnel: Track users from the moment they click a Facebook ad or a Google search result, through to browsing your product pages, and all the way to a sale. You can identify exactly where users drop off in the buying process.
- Better Marketing ROI Analysis: GA4 is designed to measure the effectiveness of your marketing campaigns across different channels. You can attribute sales to specific ads, email campaigns, or social media posts with far more accuracy than Shopify’s built-in reports alone.
- Understand User Behavior: GA4’s event-based model allows you to track specific actions beyond just page views. You’ll automatically see data on product views, add-to-carts, initiated checkouts, and purchases, giving you a granular view of shopper engagement.
- Future-Proofing Your Analytics: Google's old analytics platform, Universal Analytics, is obsolete. GA4 is the current standard and the platform that will continue to receive updates, new features, and powerful AI-driven insights.
Before You Begin: What You’ll Need
The setup process is surprisingly straightforward. You just need two things before you can get started:
- Administrator access to your Shopify backend.
- A Google Account to create and manage your new Google Analytics property.
That's it! You don't need any coding skills or any prior experience with older versions of Google Analytics.
Step 1: Create a New Google Analytics 4 Property
First, we need to generate a unique GA4 tracking ID for your Shopify store. If you already have a GA4 property set up for your website, you can skip to the end of this section and simply copy your existing Measurement ID.
If you're starting from scratch, follow these instructions:
- Go to https://analytics.google.com and log in with your Google account.
- Click the Admin gear icon in the bottom-left corner.
- In the Property column, click the blue + Create Property button.
- Enter a Property name (e.g., "My Shopify Store"). Select your store’s Reporting time zone and Currency. Click Next.
- Provide some basic business information, like your industry category and business size. This helps Google provide you with relevant benchmarking data later on. Click Next.
- Choose your business objectives. For an e-commerce store, a good starting point is selecting Drive online sales. Click Create.
- You'll now be asked to set up a "data stream." This is the source of the data for your property. Since you have a Shopify store, choose Web.
Setting Up Your Web Data Stream
This is where you'll get the ID that connects everything together. On the "Set up data stream" page, complete the following:
- In the Website URL field, enter your store’s primary domain (e.g., www.yourbrand.com). Don't use your .myshopify.com domain unless that's what your customers use.
- Give your stream a friendly Stream name, like "Official Website" or "Shopify Store E-commerce."
- Ensure that Enhanced measurement is turned on. This is crucial as it automatically tracks important actions like page views, scrolls, outbound clicks, and site search without any extra configuration.
- Click Create stream.
After a moment, you'll see a panel with your stream details. The most important piece of information here is the Measurement ID, which looks like G-XXXXXXXXXX. Copy this ID - you'll need it in the next step.
Step 2: Add Your GA4 Measurement ID to Shopify
Now that you have your Measurement ID, it's time to add it to your Shopify store. Shopify has a native integration that makes this incredibly simple.
- In a new browser tab, log in to your Shopify Admin dashboard.
- On the left-hand menu, click on Online Store, and then select Preferences from the sub-menu.
- Scroll down until you find the section labeled "Google Analytics."
- You'll see a field titled "Google Analytics 4 measurement ID." This is where you'll paste the Measurement ID (e.g., G-XXXXXXXXXX) that you copied from Google Analytics.
- Note: If you previously had the old Universal Analytics connected, you might see a code starting with "UA". You'll want to remove that old code to avoid any tracking conflicts. The new format is what you need.
- Click Save at the top right of the page.
And that’s it! You’ve successfully installed the Google Analytics 4 tag on every page of your Shopify store, including the checkout pages.
Step 3: Verify That the Connection is Working
After setting everything up, you'll want to confirm that Google is actually receiving data from your Shopify store. The easiest way to check this is by using the Realtime report in GA4.
- In one browser tab, navigate back to your Google Analytics account. From the left-hand menu, go to Reports > Realtime.
- In another tab or on your smartphone, open your live Shopify store and browse a few pages. Click on a product and maybe add it to your cart.
- Go back to the GA4 Realtime report. Within a minute or two, you should see yourself appear as a visitor. The cards should update to show your location and the specific pages you are viewing on your site.
If you see your activity in the Realtime report, congratulations! Your installation was a success. Keep in mind that while Realtime data appears instantly, it can take 24-48 hours for data to fully populate in the standard reports like traffic acquisition and engagement reports.
What Shopify's Native Integration Tracks Automatically
The beauty of this simple installation method is that Shopify automatically sends several key e-commerce events to Google Analytics 4. You don't need to do any extra "event tracking" configuration for the core shopping funnel. The moment you connect GA4, you’ll start tracking:
page_view- When a user views any page on your store.view_item- When a user views a specific product detail page.add_to_cart- When a user adds one or more items to their shopping cart.begin_checkout- When a user starts the checkout process.add_payment_info- When a user submits payment info.purchase- When a user completes a transaction.
This ready-to-go setup provides immediate visibility into your core e-commerce funnel, so you can start analyzing shopper behavior right away.
Next Steps: A Few Essential Settings to Configure
Your tracking is active, but there are a few settings you should adjust now to ensure you're gathering high-quality data from day one.
1. Exclude Your Internal Traffic
You and your team visit your own website all the time - to check on changes, fulfill orders, or write blog posts. This activity can skew your analytics, making your traffic and engagement numbers look artificially high. You should filter it out.
- In GA4, go back to Admin.
- In the Property column, click on Data Streams and select your web stream.
- Scroll down and click on Configure tag settings.
- Under Settings, click Show all, then click Define internal traffic.
- Click the Create button. Give your rule a name like "Office IP Address." Keep the
traffic_typevalue asinternal. - Go to Google and search "what is my IP address?". Copy the public IP address it shows you.
- Back in GA4, under IP address > Match type, select IP address equals and paste your IP. Click Create.
This process tags your traffic, but you still have to activate the filter. Return to Admin > Data Settings > Data Filters. Click on the "Internal Traffic" filter and change its state from 'Testing' to 'Active'. Now, your visits won't clutter your reports.
2. Increase Your Data Retention Period
By default, GA4 only stores granular user-level data (like a person's click path) for two months. This is often too short for year-over-year comparisons or long-term trend analysis. You can extend this for free.
- Go to Admin > Data Settings > Data Retention.
- From the
Event data retentiondrop-down menu, change "2 months" to 14 months. - Click Save.
Final Thoughts
Connecting GA4 to Shopify is a simple copy-paste process that unlocks a world of powerful data. By following the steps above, you've established a solid analytics foundation that will help you make smarter decisions about your marketing, products, and overall user experience.
Once your data is flowing, we know the next challenge isn't just collecting it, but turning it into easy-to-understand insights. Instead of spending hours in GA4's complex interface or exporting spreadsheets, we developed a tool to simplify the entire process. At https://www.graphed.com/register, you can connect sources like Google Analytics and Shopify, and then just ask an AI analyst in plain English to build a real-time "cockpit" dashboard measuring the KPIs that matter most to your business–all in a matter of seconds.
Related Articles
How to Connect Facebook to Google Data Studio: The Complete Guide for 2026
Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.
Appsflyer vs Mixpanel: Complete 2026 Comparison Guide
The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.
DashThis vs AgencyAnalytics: The Ultimate Comparison Guide for Marketing Agencies
When it comes to choosing the right marketing reporting platform, agencies often find themselves torn between two industry leaders: DashThis and AgencyAnalytics. Both platforms promise to streamline reporting, save time, and impress clients with stunning visualizations. But which one truly delivers on these promises?