How to integrate Google Analytics on Shopify

beginner 8 min read Updated 2026-03-18
Quick Answer

Integrating Google Analytics with Shopify requires creating a GA4 property, copying the measurement ID, and adding it to your Shopify settings under Online Store > Preferences. Enhanced ecommerce tracking can be enabled for detailed sales data.

Prerequisites

  • Active Shopify store
  • Google account
  • Admin access to Shopify dashboard
  • Basic understanding of website analytics

Step-by-Step Instructions

1

Create Google Analytics 4 Property

Go to Google Analytics and sign in with your Google account. Click Admin in the bottom left, then Create Property. Enter your store name, select your country and currency, then choose E-commerce as your business category.
Make sure to select the same currency used in your Shopify store for accurate reporting
2

Set Up Data Stream

After creating the property, click Web under data streams. Enter your Shopify store URL (including https://) and give your stream a name. Click Create stream to generate your measurement ID starting with G-.
3

Copy Your Measurement ID

In the web stream details page, locate your Measurement ID (format: G-XXXXXXXXXX). Copy this ID as you'll need it for Shopify integration. You can also find this under Admin > Data Streams > Web > Stream details.
Save this ID in a secure location as you'll need it for other integrations too
4

Access Shopify Analytics Settings

Log into your Shopify admin dashboard and navigate to Online Store > Preferences. Scroll down to the Google Analytics section. If you don't see this section, ensure you have the proper admin permissions.
5

Add Google Analytics ID to Shopify

In the Google Analytics account field, paste your GA4 measurement ID (starting with G-). Make sure Use Enhanced Ecommerce is checked to track detailed purchase data, cart actions, and product performance.
Enhanced Ecommerce provides valuable insights into customer behavior and sales funnel performance
6

Configure Customer Privacy Settings

Under Customer privacy in the same preferences page, ensure your privacy policy is linked and Enable customer data collection is checked. This ensures compliance with privacy regulations while maintaining tracking functionality.
7

Save and Test Integration

Click Save to apply your Google Analytics settings. Visit your store's frontend and perform test actions like viewing products or adding items to cart. Check your GA4 real-time reports to verify data is being tracked correctly.
It may take 24-48 hours for full ecommerce data to appear in Google Analytics reports
8

Enable Google Analytics Enhanced Ecommerce Events

In Google Analytics, go to Configure > Events and verify that ecommerce events like purchase, add_to_cart, and view_item are being tracked. You can also create custom conversions for specific business goals.
Set up conversion goals for newsletter signups, account creation, and other valuable customer actions

Common Issues & Troubleshooting

Google Analytics data not showing up after integration

Check that you used the correct GA4 measurement ID (starting with G-) and not the old Universal Analytics ID. Clear your browser cache and wait 24-48 hours for data to populate.

Ecommerce tracking not working properly

Ensure Enhanced Ecommerce is enabled in Shopify preferences and that your store's checkout process allows analytics tracking. Check if any ad blockers are interfering with tracking.

Duplicate tracking or inflated numbers

Remove any manually added Google Analytics code from your theme files if you're using Shopify's built-in integration. Check theme.liquid for duplicate tracking scripts.

Real-time data showing but historical data missing

Google Analytics only tracks data from the integration date forward - it cannot collect historical data. Wait 24-48 hours for complete ecommerce reports to appear in your dashboard.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official Shopify website before purchasing.