technical-guidesUpdated 2025

Shopify UTM Tracking: Complete Setup Guide (2025)

Step-by-step guide to implementing UTM tracking on Shopify stores. Learn how to track email campaigns, social ads, affiliate links, and measure campaign ROI in GA4.

12 min readtechnical-guides

You're running multiple marketing campaigns for your Shopify store—email promotions, Facebook ads, Instagram posts, affiliate partnerships. But when you check GA4, you can't tell which campaigns actually drive sales.

The problem: Without proper UTM tracking, all your Shopify traffic looks the same. You can't measure campaign ROI, optimize ad spend, or identify your best-performing channels.

The solution: Implement systematic UTM tracking across all your Shopify marketing campaigns.

This guide shows you exactly how to set up UTM tracking on Shopify, including:

  • GA4 integration for Shopify
  • UTM parameters for email, social, and paid campaigns
  • Tracking checkout attribution correctly
  • Avoiding common Shopify tracking pitfalls
  • Measuring campaign ROI

By the end, you'll have complete attribution clarity for your Shopify store.

🚨 Not sure what's breaking your tracking?

Run a free 60-second audit to check all 40+ ways UTM tracking can fail.

Scan Your Campaigns Free

✓ No credit card ✓ See results instantly

Why Shopify Stores Need UTM Tracking

Shopify doesn't automatically track which campaigns drive sales. By default, GA4 sees:

Without UTM tracking:

  • Sale happened: ✅
  • Which campaign drove it: ❌

With UTM tracking:

  • Sale happened: ✅
  • Campaign: spring-email-30pct-off ✅
  • Source: customer-newsletter ✅
  • Revenue: $450 ✅
  • ROI: 3.2x ROAS ✅

Example: You spend $5,000 across email ($2,000), Facebook ads ($2,000), and affiliate partners ($1,000). Without UTM tracking, you can't tell which channel delivered the best ROI. With UTM tracking, you discover:

  • Email: $12,000 revenue (6x ROAS) → Increase budget
  • Facebook: $3,000 revenue (1.5x ROAS) → Optimize or reduce
  • Affiliates: $1,500 revenue (1.5x ROAS) → Maintain current spend

Result: Shift budget from Facebook to email, increase total revenue by 40%.

Prerequisites: GA4 Setup for Shopify

Before implementing UTM tracking, ensure GA4 is properly configured.

Step 1: Install GA4 on Shopify

Option 1: Shopify's Built-in GA4 Integration (Recommended)

  1. Shopify AdminSettingsApps and sales channels
  2. Click GoogleConnect Google account
  3. Authorize Shopify to access Google Analytics
  4. Select your GA4 Property
  5. Click Connect

Shopify automatically:

  • Adds GA4 tracking code to all pages
  • Sets up e-commerce events (view_item, add_to_cart, purchase)
  • Configures enhanced measurement

Option 2: Manual GTM Installation (Advanced)

If you need custom tracking or already use Google Tag Manager:

  1. Google Tag ManagerCreate Container (Shopify store)

  2. Copy GTM container code

  3. Shopify AdminOnline StoreThemesEdit code

  4. Paste GTM code in theme.liquid:

    • Head section: GTM <script> snippet
    • Opening <body> tag: GTM <noscript> snippet
  5. Save

  6. In GTM → Create GA4 tag:

    • Tag type: Google Analytics: GA4 Configuration
    • Measurement ID: Your GA4 property ID (G-XXXXXXXXXX)
    • Trigger: All Pages
  7. Publish GTM container

Step 2: Verify GA4 Tracking

  1. Visit your Shopify store in incognito mode
  2. Open GA4 → ReportsRealtime
  3. Should see your visit within 30 seconds
  4. Navigate to a product page
  5. GA4 Realtime should show page_view and view_item events

If not working:

  • Check GTM preview mode for errors
  • Verify Measurement ID is correct
  • Check browser console for JavaScript errors
  • Ensure ad blockers are disabled during testing

😰 Is this your only tracking issue?

This is just 1 of 40+ ways UTM tracking breaks. Most marketing teams have 8-12 critical issues they don't know about.

• 94% of sites have UTM errors

• Average: $8,400/month in wasted ad spend

• Fix time: 15 minutes with our report

✓ Connects directly to GA4 (read-only, secure)

✓ Scans 90 days of data in 2 minutes

✓ Prioritizes issues by revenue impact

✓ Shows exact sessions affected

Get Your Free Audit Report

UTM Tracking for Shopify Marketing Channels

Email Campaigns (Klaviyo, Mailchimp, Shopify Email)

Email is often the highest-ROI channel for Shopify stores. Proper UTM tracking lets you measure which email campaigns drive the most revenue.

Klaviyo UTM Setup

Method 1: Global UTM Settings (Recommended)

  1. KlaviyoSettingsEmail Settings

  2. Tracking section → UTM Tracking

  3. Enable "Add UTM parameters to all links"

  4. Configure default values:

    Code
    utm_source = klaviyo
    utm_medium = email
    utm_campaign = {{ campaign.name }} (dynamic)
    
  5. Save

All future email campaigns automatically get UTM parameters.

Method 2: Per-Campaign UTMs

For granular control:

  1. Create email campaign in Klaviyo

  2. Email Editor → Click any link

  3. Link settingsAdd UTM parameters:

    Code
    utm_source=welcome-series
    utm_medium=email
    utm_campaign=day-3-product-intro
    utm_content=hero-cta
    
  4. Repeat for all links (or use global settings above)

Recommended naming:

Code
Welcome series:
utm_campaign=welcome-series-day-1
utm_campaign=welcome-series-day-3
utm_campaign=welcome-series-day-7

Promotional emails:
utm_campaign=spring-sale-30pct-off-mar-2025
utm_campaign=flash-sale-24hr-jan-15-2025

Post-purchase:
utm_campaign=post-purchase-upsell
utm_campaign=review-request-email

See complete guide: Email UTM Best Practices


Mailchimp UTM Setup

  1. Create campaign in Mailchimp

  2. Design email → Add links

  3. Click linkLink settingsTrack with Google Analytics

  4. Enable tracking, configure:

    Code
    Campaign Source: newsletter
    Campaign Medium: email
    Campaign Name: spring-sale-mar-2025
    
  5. Save and continue

Mailchimp automatically appends UTMs to all links in the email.


Shopify Email UTM Setup

Shopify's built-in email doesn't have automatic UTM settings. You must manually add UTMs to each link.

How to add UTMs:

  1. Shopify AdminMarketingCreate campaignShopify Email
  2. Design email
  3. For each link, modify URL:

Before:

Code
https://yourstore.com/collections/spring-sale

After:

Code
https://yourstore.com/collections/spring-sale?utm_source=shopify-email&utm_medium=email&utm_campaign=spring-sale-mar-2025

Tedious? Yes. Consider switching to Klaviyo for automatic UTM handling.


Social Media Campaigns

For paid campaigns: Use platform auto-tagging instead of manual UTMs.

Facebook/Instagram Ads:

  1. Ads ManagerCampaign Settings
  2. URL Parameters → Leave blank
  3. Facebook automatically appends fbclid
  4. GA4 recognizes fbclid → attributes to Paid Social

See detailed guide: Facebook Auto-Tagging vs Manual UTMs

TikTok Ads:

  • TikTok appends ttclid automatically
  • No manual UTMs needed

Organic Social Posts (Instagram, Facebook, TikTok, Pinterest)

For organic posts (not ads), manual UTMs are required.

Recommended format:

Code
utm_source=instagram (or facebook, tiktok, pinterest)
utm_medium=social
utm_campaign=spring-collection-launch
utm_content=reel-1 (or post-carousel, story-link, etc.)

Examples:

Instagram bio link:

Code
https://yourstore.com?utm_source=instagram&utm_medium=social&utm_campaign=bio-link

Instagram story link:

Code
https://yourstore.com/new-arrivals?utm_source=instagram&utm_medium=social&utm_campaign=spring-collection&utm_content=story-swipe-up

Pinterest pin:

Code
https://yourstore.com/product/blue-dress?utm_source=pinterest&utm_medium=social&utm_campaign=spring-pins

TikTok bio link:

Code
https://yourstore.com?utm_source=tiktok&utm_medium=social&utm_campaign=bio-link

Pro tip: Use link shorteners (Bitly, Linktr.ee) with UTM parameters for cleaner-looking links:

  1. Create full UTM URL
  2. Shorten with Bitly
  3. Post shortened link (UTMs preserved when clicked)

Affiliate & Influencer Campaigns

Track affiliate and influencer performance with unique UTM source values.

Recommended format:

Code
utm_source=[affiliate-name or influencer-handle]
utm_medium=affiliate (or influencer)
utm_campaign=[campaign-name]

Examples:

Affiliate partner:

Code
https://yourstore.com?utm_source=styleguide-com&utm_medium=affiliate&utm_campaign=spring-partnership-2025

Influencer promotion:

Code
https://yourstore.com/collection/dresses?utm_source=fashionista-ig&utm_medium=influencer&utm_campaign=spring-collab&utm_content=reel-1

Unique discount codes + UTMs (recommended):

Combine unique discount codes with UTM tracking:

  1. Create unique discount code: FASHIONISTA20

  2. Create custom UTM link:

    Code
    https://yourstore.com?utm_source=fashionista-ig&utm_medium=influencer&utm_campaign=spring-collab&discount=FASHIONISTA20
    
  3. GA4 tracks attribution via UTMs

  4. Shopify discount usage confirms sales

  5. Cross-reference to validate influencer performance

Result: You know exactly which influencer drove sales, not just who had most link clicks.


Don't use manual UTMs for paid search. Use auto-tagging instead.

Google Ads:

  1. SettingsAccount SettingsAuto-taggingEnable
  2. Google appends gclid automatically
  3. GA4 attributes to Paid Search

Microsoft Ads:

  1. SettingsAuto-taggingEnable
  2. Microsoft appends msclkid
  3. GA4 attributes to Paid Search

See detailed guide: Google Ads: When to Skip UTMs


Shopify-Specific Tracking Challenges

Issue 1: Checkout Stealing Campaign Attribution

Problem: Shopify's checkout process can break UTM tracking.

What happens:

  1. User clicks UTM-tagged link from email
  2. Browses products
  3. Adds to cart
  4. Goes to checkout (yourstore.com/checkouts/abc123)
  5. UTM parameters lost during checkout
  6. Purchase attributed to "Direct" instead of email campaign

Why it happens: Shopify's checkout is on a different subdomain or uses redirects that strip UTMs.

Solution: Ensure GA4's enhanced measurement captures UTM parameters before checkout.

How to fix:

  1. GA4AdminData StreamsYour Shopify stream

  2. Enhanced measurementEnsure enabled:

    • Page views ✅
    • Scrolls ✅
    • Outbound clicks ✅
    • Site search ✅
    • Form interactions ✅
  3. Verify purchase events include campaign parameters:

    • GA4 → ReportsMonetizationPurchase
    • Add dimension: Session campaign
    • Should show campaign names, not "(direct)"

If still broken: You may need custom GTM implementation to persist UTM parameters through checkout. See Shopify Checkout Attribution Fix.


Issue 2: Tracking Discount Code Campaigns

Problem: You run campaigns with unique discount codes but can't connect discount usage back to campaigns in GA4.

Solution: Add discount code to UTM link + track in GA4.

How:

Step 1: Create discount code

  • Shopify Admin → Discounts → Create discount code: SPRING30

Step 2: Build UTM link with discount code:

Code
https://yourstore.com?utm_source=email&utm_medium=email&utm_campaign=spring-sale-mar-2025&discount=SPRING30

Step 3: GA4 custom dimension (Optional - Advanced)

Track discount code as custom dimension:

  1. GTMVariablesNew User-Defined Variable

    • Variable type: URL
    • Component Type: Query
    • Query Key: discount
    • Variable name: Discount Code
  2. GA4AdminCustom definitionsCreate custom dimension

    • Dimension name: discount_code
    • Scope: Event
    • Event parameter: discount_code
  3. GTMGA4 Event tag → Add event parameter:

    • Parameter name: discount_code
    • Value: {{Discount Code}}

Result: GA4 reports show which campaigns used which discount codes and their revenue.


Measuring Campaign ROI in GA4

View Campaign Performance

Standard Report:

  1. GA4ReportsAcquisitionTraffic acquisition

  2. Add filter: Session source (select your campaigns)

  3. Columns show:

    • Users
    • Sessions
    • Engagement rate
    • Conversions
    • Total revenue
  4. Calculate ROAS:

    Code
    ROAS = Total Revenue / Ad Spend
    

Example:

  • Campaign: spring-email-30pct-off
  • Total revenue (from GA4): $12,450
  • Ad spend (email platform): $2,000
  • ROAS: 12,450 / 2,000 = 6.22x

Create dedicated dashboard for campaign analysis:

  1. GA4ExploreBlank exploration

  2. Dimensions → Add:

    • Session source
    • Session medium
    • Session campaign
    • Date
  3. Metrics → Add:

    • Users
    • New users
    • Sessions
    • Conversions (purchase events)
    • Total revenue
    • Average purchase revenue
  4. Filters:

    • Session medium = email (or cpc, social, affiliate)
  5. Save as template

Result: One-click view of all campaign performance with revenue attribution.


UTM Tracking Checklist for Shopify

GA4 Setup:

  • GA4 property connected to Shopify
  • E-commerce events firing (view_item, purchase)
  • Enhanced measurement enabled
  • Verified in GA4 Realtime

Email Campaigns:

  • UTM parameters on all email links
  • Consistent naming convention (source, medium, campaign)
  • Klaviyo/Mailchimp auto-UTM enabled
  • Tested email → Shopify → GA4 attribution

Social Media:

  • Paid social uses auto-tagging (fbclid, ttclid)
  • Organic posts have manual UTMs
  • Bio links tagged with UTMs
  • Link shorteners preserve UTMs

Affiliates/Influencers:

  • Unique UTM source per partner
  • Discount codes match UTM campaigns
  • Performance tracking in GA4

Checkout Attribution:

  • Purchase events include campaign attribution
  • No "(direct)" revenue (unless truly direct)
  • Enhanced measurement captures UTMs through checkout

ROI Tracking:

  • Campaign revenue visible in GA4
  • Ad spend documented per campaign
  • ROAS calculated monthly
  • Budget allocation based on data

FAQ

Do Shopify's native integrations add UTM parameters automatically?

No. Shopify doesn't add UTM parameters automatically. You must add them manually or use your email/ad platform's UTM features (like Klaviyo's auto-UTM).

Can I track Shopify's abandoned cart emails with UTMs?

Yes. Shopify's built-in abandoned cart emails don't support UTM parameters, but Klaviyo and other email platforms do. Recommended: Use Klaviyo for abandoned cart emails with automatic UTM tracking.

Does Shopify's Shop Pay affect UTM tracking?

Shop Pay (Shopify's accelerated checkout) can sometimes interfere with UTM tracking if users bypass standard checkout. Ensure GA4's enhanced measurement is enabled to capture parameters before Shop Pay loads.

If influencers share your product organically without UTM links, those sales will appear as Organic Social (instagram / referral, etc.) in GA4. For accurate attribution:

  1. Always provide influencers with custom UTM links
  2. Use unique discount codes to cross-reference
  3. Consider affiliate programs for automatic tracking

Can I use UTM parameters for Shopify's "Buy Button" on external sites?

Yes. When generating Buy Button code, append UTM parameters to the product URL. Example:

Code
https://yourstore.com/products/blue-dress?utm_source=partner-blog&utm_medium=affiliate&utm_campaign=spring-collab

Why do some sales show as "Direct" even though I used UTMs?

Common causes:

  1. Customer bookmarked page without UTMs, returned later to purchase
  2. Checkout redirect stripped UTMs (see Issue 1 above)
  3. Customer manually typed URL (true direct traffic)
  4. Payment processor redirect removed UTMs
  5. User switched devices between click and purchase

Fix: Ensure enhanced measurement and cross-device tracking are enabled in GA4.

How do I track Shopify POS (Point of Sale) purchases with campaign attribution?

Shopify POS purchases don't have UTM attribution since they're in-person. However, you can:

  1. Ask customers "How did you hear about us?" during checkout
  2. Create custom "referral source" field in POS
  3. Export POS data and join with online campaign data for holistic analysis

Can I use custom UTM parameters for Shopify (like utm_promo or utm_code)?

GA4 only recognizes the 5 standard UTM parameters. However, you can add custom query parameters (like ?promo=spring30) and capture them with custom dimensions in GA4.

Does Shopify Markets (multi-currency) affect UTM tracking?

No. UTM tracking works across Shopify Markets. However, ensure GA4's currency conversion is configured correctly to aggregate revenue across markets.

How often should I audit my Shopify UTM tracking?

Monthly minimum:

  • Export campaign report from GA4
  • Verify all active campaigns appear correctly
  • Check for (direct) revenue (should be minimal)
  • Confirm ROAS calculations align with ad spend

Quarterly deep dive:

  • Review naming conventions for consistency
  • Audit email platform UTM settings
  • Test checkout attribution end-to-end
  • Update team documentation

Conclusion

UTM tracking transforms your Shopify store from blind guessing to data-driven optimization.

Without UTM tracking:

  • ❌ Can't measure campaign ROI
  • ❌ Don't know which channels drive sales
  • ❌ Waste budget on underperforming campaigns

With UTM tracking:

  • ✅ Know exactly which email campaigns drive highest revenue
  • ✅ Identify best-performing influencer partnerships
  • ✅ Calculate ROAS for every marketing dollar
  • ✅ Optimize budget allocation based on real data

Implementation checklist:

  1. Set up GA4 on Shopify (use built-in integration)
  2. Configure email platform UTMs (Klaviyo, Mailchimp)
  3. Add UTMs to all social, affiliate, and partner links
  4. Use auto-tagging for paid ads (don't use manual UTMs)
  5. Verify checkout attribution (purchase events show campaigns)
  6. Create campaign dashboard in GA4
  7. Calculate ROAS monthly and optimize spend

Next steps:

  1. Follow this guide to implement UTM tracking
  2. Run campaigns for 30 days with proper tracking
  3. Analyze results in GA4
  4. Shift budget to highest-ROI channels
  5. Repeat monthly for continuous optimization

Your Shopify store can grow 2-3x faster when you know which campaigns actually work.


Related Guides:

External Resources:

✅ Fixed this issue? Great! Now check the other 39...

You just fixed one tracking issue. But are your Google Ads doubling sessions? Is Facebook attribution broken? Are internal links overwriting campaigns?

Connects to GA4 (read-only, OAuth secured)

Scans 90 days of traffic in 2 minutes

Prioritizes by revenue impact

Free forever for monthly audits

Run Complete UTM Audit (Free Forever)

Join 2,847 marketers fixing their tracking daily

UTM

Get Your Free Audit in 60 Seconds

Connect GA4, run the scan, and see exactly where tracking is leaking budget. No credit card required.

Trusted by growth teams and agencies to keep attribution clean.