Setting up Google analytics 4 on Shopify after WooCommerce migration (2026)
How to set up GA4 on Shopify after migrating from WooCommerce — configuring ecommerce tracking, preserving historical data, comparing pre/post migration metrics, and avoiding data gaps.
One of the first post-migration tasks is connecting Google Analytics 4 to your new Shopify store. This guide covers how to do that properly — preserving historical context, configuring ecommerce tracking, and avoiding data gaps that make post-migration performance comparison difficult.
Should you use the same GA4 property or create a new one?
Use the same GA4 property you used on WooCommerce. Reasons:
- Maintains historical comparisons (year-over-year, pre/post migration)
- Preserves audiences and segments built from historical data
- Keeps your Google Ads and Search Console integrations connected
- Avoids losing the trust signals GA builds over time (conversion baselines, etc.)
Exception: if your WooCommerce and Shopify stores are actually different products/brands, or if you're moving to a different domain, create a new property. But for a standard platform migration of the same store, use the same property.
Method 1: Shopify's native Google channel (simplest)
Shopify has a native Google channel that handles basic GA4 + Google Ads integration:
- In Shopify Admin, go to Sales channels → Add sales channel → Google
- Connect your Google account and select your GA4 property
- Enable "Web pixel" option for Shopify
- Shopify will automatically add the GA4 base tag and basic ecommerce events
What this method tracks: Page views, session data, and basic purchase events (purchase, add_to_cart, begin_checkout, view_item).
What this method misses: Some advanced ecommerce events (view_item_list, select_item, search), custom event tracking, and some data that requires Customer Events API or GTM for full coverage.
Method 2: Customer Events (Shopify's custom tracking system)
For more granular tracking, use Shopify's Customer Events (formerly Shopify Pixels):
- In Shopify Admin → Settings → Customer events
- Add a pixel → Custom pixel
- Paste your GA4 tracking code with event listeners for Shopify's standard events
Shopify fires standard events (page_viewed, cart_viewed, checkout_started, checkout_completed, product_viewed, collection_viewed, search_submitted) that you can forward to GA4.
Example pixel code for GA4 via Customer Events:
// Load GA4
(function(){
var script = document.createElement('script');
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX';
document.head.appendChild(script);
})();
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
// Shopify standard events → GA4
analytics.subscribe('page_viewed', (event) => {
gtag('event', 'page_view', { page_location: event.context.window.location.href });
});
analytics.subscribe('checkout_completed', (event) => {
const order = event.data.checkout;
gtag('event', 'purchase', {
transaction_id: order.order.id,
value: parseFloat(order.totalPrice.amount),
currency: order.totalPrice.currencyCode,
items: order.lineItems.map(item => ({
item_id: item.variant.sku,
item_name: item.title,
price: parseFloat(item.variant.price.amount),
quantity: item.quantity,
}))
});
});
// Add more events as needed
Method 3: Google Tag Manager (most flexible)
If you used GTM on WooCommerce, continue using it on Shopify:
- In Shopify Admin, go to Online Store → Themes → Edit code
- Add the GTM snippet to
theme.liquid(in <head> and after <body>) - Or use a Shopify GTM app (e.g., "GTM & GA4 + Google Ads" from Shopify App Store) for easier management
GTM on Shopify has some quirks:
- Checkout pages are on a subdomain (
checkout.shopify.com) — requires extra configuration for cross-domain tracking - Thank you / order confirmation page needs the "Additional scripts" section in Shopify checkout settings for purchase confirmation tracking
- Shopify Plus has more customization options for the checkout page
Configuring cross-domain tracking (important for checkout)
Shopify checkout runs on yourstore.myshopify.com or checkout.shopify.com — different from your main domain. GA4 needs cross-domain tracking to attribute conversions correctly.
In GA4 Admin → Data Streams → your stream → Configure tag settings → Configure your domains:
- Add your main domain (e.g.,
yourstore.com) - Add
yourstore.myshopify.com - Add
checkout.shopify.comif applicable
Without cross-domain tracking, GA4 counts every checkout page view as a new session from a new user, inflating session counts and breaking attribution.
Preserving your WooCommerce historical data
GA4 data from WooCommerce doesn't disappear when you migrate — it stays in your GA4 property. However:
- URL changes affect reports: WooCommerce used
/product/slug/; Shopify uses/products/slug. Top Pages reports will show different URLs for the same product before and after migration. - Transaction data may differ: If WooCommerce's GA4 ecommerce tracking was incomplete or inconsistent, your baseline conversion rate may be unreliable. Document this before migration.
- Annotate the migration date: In GA4, you can't annotate directly (unlike UA), but use Notes in Search Console or a Google Sheets dashboard annotation.
Best practice: export a snapshot of key metrics before going live on Shopify. Create a custom report in GA4 and export/save:
- Last 90 days of sessions, users, revenue
- Top 20 landing pages by sessions
- Top 10 products by revenue
- Conversion rate (by device type)
- Channel-level traffic (organic, paid, email, direct)
This becomes your "pre-migration baseline" for comparison 30/60/90 days post-launch.
What to monitor after going live on Shopify
First week
- Is GA4 receiving data? (Check Realtime report while browsing your own store)
- Are purchase events firing? (Place a test order and verify it appears in GA4)
- Is the conversion rate roughly similar to WooCommerce? (±20% is normal in first week)
- Are sessions attributed to correct channels? (Not all going to "Direct")
First month
- Compare organic traffic to WooCommerce baseline (expect 10–30% dip)
- Compare top landing pages — which Shopify URLs are getting the most visits?
- Check for 404 pages in landing data (means a redirect is missing)
- Review Search Console for coverage errors and impressions trend
3-month mark
- Organic traffic should be recovering toward pre-migration levels
- Conversion rate should stabilize above WooCommerce baseline (Shopify is typically faster)
- Any persistent 404 errors should be addressed with redirects
Quick GA4 audit after going live
Run this 24 hours after DNS cutover:
- GA4 Realtime: Is traffic showing? Are the right pages showing?
- Events report: Are purchase, add_to_cart, begin_checkout showing?
- Conversions: Is "purchase" marked as a conversion? Is transaction_id populating?
- Channel grouping: Is Direct unusually high? (May indicate missing UTM parameters or cross-domain setup)
- Sessions: Are session counts in expected range compared to pre-migration?
- Search Console integration: Is it still linked and receiving data?
GA4 setup is one of those tasks that's easy to do quickly but hard to redo if done wrong. Take the time to validate that ecommerce tracking is correct on day 1 — incorrect tracking during the first 30 days creates gaps that affect reporting for months.
Migrate your store with k-sync
Connect your WooCommerce store, validate your products, and push to Shopify in minutes. Free for up to 50 products.
Get started freeRelated reading
Migrating a luggage and travel accessories store from WooCommerce to Shopify (2026)
How to migrate a luggage, travel bags, or travel accessories WooCommerce store to Shopify — luggage specifications, airline compliance, TSA lock, warranty and durability claims, and luggage retail Shopify setup.
Migrating a motorcycle accessories store from WooCommerce to Shopify (2026)
How to migrate a motorcycle accessories, biker gear, or motorbike parts WooCommerce store to Shopify — helmet safety standards, CE-rated protective clothing, type approval for parts, fitment compatibility, and motorcycle retail Shopify setup.