How to Add Google Analytics Tag to Shopify
Adding Google Analytics to your Shopify store is one of the smartest moves you can make to understand your customers and grow your business. This article will walk you through exactly how to connect Shopify and Google Analytics, from creating your account to verifying that everything is tracking correctly.
Why You Should Connect Google Analytics to Your Shopify Store
While Shopify's built-in analytics are useful for a quick overview, Google Analytics (specifically the latest version, GA4) gives you a much richer, more detailed picture of your store's performance. Think of it as upgrading from a simple sketch to a high-resolution photograph.
Here’s what you gain by making the connection:
- Deeper Audience Insights: Go beyond basic traffic numbers. Learn about your visitors' demographics (age, gender), interests, and what city or country they're shopping from. This information is gold for targeting your marketing campaigns effectively.
- Complete Customer Journey Mapping: See exactly how people find you. Did they click an ad on Facebook, search on Google, or come from an influencer's link? Google Analytics shows you the entire path they take on your site - from the landing page to the product page and, hopefully, to the checkout confirmation.
- Clear Marketing Channel Performance: Stop guessing which marketing channels are working. GA4 helps you attribute sales and conversions to specific campaigns, so you can confidently decide whether to double down on your Google Ads budget or invest more in email marketing.
- Checkout Funnel Analysis: Discover where shoppers are dropping off during the checkout process. By identifying friction points, you can make targeted improvements to your cart and checkout pages to boost your conversion rate.
Simply put, Shopify tells you what happened, while Google Analytics helps you understand why it happened.
Before You Start: Creating a Google Analytics 4 Property
Before you can connect anything to Shopify, you need a place for the data to go. This means setting up a Google Analytics 4 property. If you already have one, you can skip to the next section. If you're new to this or only have an old Universal Analytics property, follow these steps.
A quick note: Google sunsetted its old version, Universal Analytics (UA), in 2023. All new setups must use Google Analytics 4.
Step-by-Step Guide to Creating Your GA4 Property:
- Sign into Google Analytics: Navigate to the Google Analytics website and sign in with your Google account.
- Go to Admin: Once you're in, find and click the gear icon labeled "Admin" in the bottom-left corner.
- Create an Account or Property:
- Name Your Property: Give your property a clear name (e.g., "My Awesome T-Shirt Store"). Select your reporting time zone and the currency you use in your Shopify store. This is important for accurate sales reporting.
- Provide Business Details: Answer the optional questions about your industry and business size. This helps Google provide you with relevant benchmark data.
- Accept the Terms: Review and accept the Google Analytics Terms of Service Agreement.
- Set Up Your Data Stream: Now for the most important part. GA4 collects data through "data streams." You'll be asked to choose a platform. Click on "Web".
- Enter Your Store's URL: Type in your Shopify store's website address (e.g., myawesometshirtstore.com) and give the stream a name (the default name is usually fine). Click "Create stream."
After you create the stream, a page will appear with all your web stream details. Look for your Measurement ID, which will start with "G-" followed by a string of letters and numbers (like G-XXXXXXXXXX). Copy this ID. This is the key that links your Shopify store to your Google Analytics property.
Connecting Google Analytics to Your Shopify Store
Shopify makes this process incredibly simple through its native integration. The easiest and recommended method is using the "Google & YouTube" app, which is built right into your admin dashboard.
The Recommended Method: Using the Google & YouTube Channel
This is Shopify's official and preferred way to manage the connection. It not only installs the tag but also automatically sets up Enhanced Ecommerce tracking, which is essential for seeing product views, cart activity, and purchases in GA4.
- Log into your Shopify Admin: Go to your Shopify dashboard.
- Navigate to Preferences: In the left-hand navigation menu, click on "Online Store" and then select "Preferences."
- Find the Google Analytics Section: Scroll down until you see the "Google Analytics" box.
- Add the Google & YouTube App: You'll likely see a message prompting you to set up the connection via the Google & YouTube app. Click the button to get started (it might say "Manage pixel" or "Set up Google"). This will guide you to install or configure the app if you haven't already.
- Connect Your Google Account: The app will prompt you to connect the Google Account associated with the GA4 property you just created. Sign in and grant the necessary permissions.
- Select Your GA4 Property: The app should automatically find the GA4 property you created. Simply select it from the list. If you see a spot to paste your Measurement ID, this is where you paste the "G-XXXXXXXXXX" code you copied earlier.
- You're All Set! Follow the final confirmation steps. The Google & YouTube app now handles everything in the background. It places the Google tag on every page of your store and automatically tracks key ecommerce events.
The Manual Method: Adding the Tag to Your Theme.liquid File
In some rare cases, you might want to add the code manually. This gives you more control but comes with more risk and requires you to set up ecommerce event tracking yourself (which is very complex).
Warning: Only do this if you are comfortable editing theme code. A small mistake can break your site. Always duplicate your theme before making any code changes. You should also ensure you are not also using the Google & YouTube app to avoid double-tracking your page views.
- Copy the Global Site Tag: In your Google Analytics account, go back to your web stream details page (Admin > Data Streams > click your stream). Under "Google tag," click on "View tag instructions." Copy the entire JavaScript code snippet.
- Go to Your Shopify Theme Code: In Shopify, navigate to "Online Store" > "Themes."
- Edit Code: Find your current theme, click the three-dots icon (...) and select "Edit code."
- Locate
theme.liquid: In the code editor, look for thetheme.liquidfile under the "Layout" folder and click on it. - Paste the Code: Find the opening
<head>tag near the top of the file. Paste your entire Google tag code snippet on a new line immediately after this<head>tag. - Save Your Changes: Click the "Save" button in the top right.
How to Check if Your Google Analytics Tag is Working
Don't just set it and forget it. You need to make sure data is actually flowing into your GA4 account. Here are two easy ways to verify the connection.
1. Use the GA4 Real-time Report
This is the quickest way to confirm that your tag is firing correctly.
- Open your Google Analytics account.
- In the left menu, go to Reports > Real-time.
- In a separate browser window, open your Shopify storefront. Click around on a few pages.
- Switch back to your GA4 Real-time report. You should see your visit show up under "Users in last 30 minutes" within a minute or two. If you see activity, it's working!
2. Use the Google Tag Assistant
For a more technical check, you can use Google's own browser extension.
- Install the Tag Assistant Legacy extension for Google Chrome.
- Click the extension's icon in your browser toolbar and click "Enable" for the site you want to test.
- Go to your Shopify store and refresh the page.
- Click the Tag Assistant icon again. It will show a list of all the Google tags found on the page. You should see your Google Analytics tag listed with your Measurement ID (G-XXXXXXXXXX). A green or blue icon indicates it's working properly.
Final Thoughts
Connecting Google Analytics to Shopify is a foundational step for any data-driven store owner. By setting up GA4, you unlock a powerful suite of tools that gives you visibility into how customers interact with your brand, helping you make smarter decisions about marketing, site design, and product strategy.
Once your analytics data is flowing, the next step is turning that raw data into clear, actionable insights without spending hours building manual reports. At Graphed, we make this simple. We connect directly to your Google Analytics, Shopify, and other marketing accounts. From there, you can just ask questions in plain English - like "create a dashboard showing my marketing funnel from Facebook ad clicks to Shopify purchases" or "what were my top 10 selling products last month?" - and get instant, real-time dashboards that do the heavy lifting for you.
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?