How to Add Google Analytics to a Shopify Store

Add Google Analytics 4 to your Shopify store and verify it’s working, so you can track how visitors behave on your website.

Why This Matters

Google Analytics helps you answer key questions like:
✅ How many people are visiting your website?
✅ Where are they coming from?
✅ What actions are they taking?

Installing GA4 gives you real-time and historical data to improve marketing and conversions.

Before You Start

You’ll need a Google Analytics 4 property set up already.
If you haven’t done that yet, follow SOP 163: Set up a GA4 Account.

When To Do This

  • When launching a new Shopify site
  •  When updating your analytics tracking
  • Once per store setup 

Who Does This

  • Website Manager 
  • Marketing or Analytics Team 

How To Retrieve Your GA4 Tracking Code

  1. Go to Google Analytics and log in 
  2. Click Admin (lower left corner) 
  3. Select the correct property, then click Data Streams 
  4. Click on your website stream 
  5. Under Tagging Instructions, click View tag instructions 
  6. Click Global site tag (gtag.js) 
  7. Copy the full code and save it in a text editor temporarily 

How To Add GA4 to Shopify Theme

  1. Log in to your Shopify Admin Panel 
  2. Go to Online Store → Themes → [kebab menu] → Edit Code 
  3. In the code editor, click theme.liquid 
  4. Paste your GA4 tag just after the <head> tag 
  5. Click Save 

 Optional but Recommended:

  • Go to Online Store → Preferences 
  • In the Google Analytics box, paste the same GA4 code 
  • If there’s an old Universal Analytics tag, replace it 

How To Connect GA4 to Shopify via Google App

  1. On the Shopify sidebar, click Apps 
  2. Search for and select Google Channel 
  3. Click Add Sales Channel 
  4. Click Connect Google Account 
  5. Log in using the email associated with your GA4 property 
  6. In the setup flow, click Get Started under the GA integration section 
  7. Choose your GA4 property and click Connect 

How To Verify Installation

  1. Return to Google Analytics 
  2. Go to Reports → Real-Time 
  3. Visit your Shopify site in a new browser tab 
  4. Back in GA, you should now see 1 active user from your current location 

If you don’t see activity:

  • Double-check the GA4 code placement 
  • Clear cache and reload 
  • Use the GA Debugger Chrome Extension 

Resources

  • GA4 Installation Guide 
  • GA Debugger Extension 
  • Google Channel App on Shopify 

Final Tips

✅ Always place the code inside the <head> tag
✅ Use both the code snippet and Google Channel app for full integration
✅ Check GA4 real-time reports to confirm everything is working