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.
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.
Table of contents
- Why Shopify Stores Need UTM Tracking
- Prerequisites: GA4 Setup for Shopify
- Step 1: Install GA4 on Shopify
- Step 2: Verify GA4 Tracking
- UTM Tracking for Shopify Marketing Channels
- Email Campaigns (Klaviyo, Mailchimp, Shopify Email)
- Social Media Campaigns
- Affiliate & Influencer Campaigns
- Paid Search (Google Ads, Microsoft Ads)
- Shopify-Specific Tracking Challenges
- Issue 1: Checkout Stealing Campaign Attribution
- Issue 2: Tracking Discount Code Campaigns
- Measuring Campaign ROI in GA4
- View Campaign Performance
- Custom Campaign Dashboard (Recommended)
- UTM Tracking Checklist for Shopify
- FAQ
- Do Shopify's native integrations add UTM parameters automatically?
- Can I track Shopify's abandoned cart emails with UTMs?
- Does Shopify's Shop Pay affect UTM tracking?
- How do I track sales from influencer posts if they don't use my link?
- Can I use UTM parameters for Shopify's "Buy Button" on external sites?
- Why do some sales show as "Direct" even though I used UTMs?
- How do I track Shopify POS (Point of Sale) purchases with campaign attribution?
- Can I use custom UTM parameters for Shopify (like utmpromo or utmcode)?
- Does Shopify Markets (multi-currency) affect UTM tracking?
- How often should I audit my Shopify UTM tracking?
- Conclusion
🚨 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)
- Shopify Admin → Settings → Apps and sales channels
- Click Google → Connect Google account
- Authorize Shopify to access Google Analytics
- Select your GA4 Property
- 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:
-
Google Tag Manager → Create Container (Shopify store)
-
Copy GTM container code
-
Shopify Admin → Online Store → Themes → Edit code
-
Paste GTM code in
theme.liquid:- Head section: GTM
<script>snippet - Opening
<body>tag: GTM<noscript>snippet
- Head section: GTM
-
Save
-
In GTM → Create GA4 tag:
- Tag type: Google Analytics: GA4 Configuration
- Measurement ID: Your GA4 property ID (G-XXXXXXXXXX)
- Trigger: All Pages
-
Publish GTM container
Step 2: Verify GA4 Tracking
- Visit your Shopify store in incognito mode
- Open GA4 → Reports → Realtime
- Should see your visit within 30 seconds
- Navigate to a product page
- GA4 Realtime should show
page_viewandview_itemevents
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
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)
-
Klaviyo → Settings → Email Settings
-
Tracking section → UTM Tracking
-
Enable "Add UTM parameters to all links"
-
Configure default values:
Codeutm_source = klaviyo utm_medium = email utm_campaign = {{ campaign.name }} (dynamic) -
Save
All future email campaigns automatically get UTM parameters.
Method 2: Per-Campaign UTMs
For granular control:
-
Create email campaign in Klaviyo
-
Email Editor → Click any link
-
Link settings → Add UTM parameters:
Codeutm_source=welcome-series utm_medium=email utm_campaign=day-3-product-intro utm_content=hero-cta -
Repeat for all links (or use global settings above)
Recommended naming:
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
-
Create campaign in Mailchimp
-
Design email → Add links
-
Click link → Link settings → Track with Google Analytics
-
Enable tracking, configure:
CodeCampaign Source: newsletter Campaign Medium: email Campaign Name: spring-sale-mar-2025 -
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:
- Shopify Admin → Marketing → Create campaign → Shopify Email
- Design email
- For each link, modify URL:
Before:
https://yourstore.com/collections/spring-sale
After:
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
Paid Social (Facebook, Instagram, TikTok)
For paid campaigns: Use platform auto-tagging instead of manual UTMs.
Facebook/Instagram Ads:
- Ads Manager → Campaign Settings
- URL Parameters → Leave blank
- Facebook automatically appends
fbclid - GA4 recognizes fbclid → attributes to Paid Social
See detailed guide: Facebook Auto-Tagging vs Manual UTMs
TikTok Ads:
- TikTok appends
ttclidautomatically - No manual UTMs needed
Organic Social Posts (Instagram, Facebook, TikTok, Pinterest)
For organic posts (not ads), manual UTMs are required.
Recommended format:
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:
https://yourstore.com?utm_source=instagram&utm_medium=social&utm_campaign=bio-link
Instagram story link:
https://yourstore.com/new-arrivals?utm_source=instagram&utm_medium=social&utm_campaign=spring-collection&utm_content=story-swipe-up
Pinterest pin:
https://yourstore.com/product/blue-dress?utm_source=pinterest&utm_medium=social&utm_campaign=spring-pins
TikTok bio link:
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:
- Create full UTM URL
- Shorten with Bitly
- Post shortened link (UTMs preserved when clicked)
Affiliate & Influencer Campaigns
Track affiliate and influencer performance with unique UTM source values.
Recommended format:
utm_source=[affiliate-name or influencer-handle]
utm_medium=affiliate (or influencer)
utm_campaign=[campaign-name]
Examples:
Affiliate partner:
https://yourstore.com?utm_source=styleguide-com&utm_medium=affiliate&utm_campaign=spring-partnership-2025
Influencer promotion:
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:
-
Create unique discount code:
FASHIONISTA20 -
Create custom UTM link:
Codehttps://yourstore.com?utm_source=fashionista-ig&utm_medium=influencer&utm_campaign=spring-collab&discount=FASHIONISTA20 -
GA4 tracks attribution via UTMs
-
Shopify discount usage confirms sales
-
Cross-reference to validate influencer performance
Result: You know exactly which influencer drove sales, not just who had most link clicks.
Paid Search (Google Ads, Microsoft Ads)
Don't use manual UTMs for paid search. Use auto-tagging instead.
Google Ads:
- Settings → Account Settings → Auto-tagging → Enable
- Google appends
gclidautomatically - GA4 attributes to Paid Search
Microsoft Ads:
- Settings → Auto-tagging → Enable
- Microsoft appends
msclkid - 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:
- User clicks UTM-tagged link from email
- Browses products
- Adds to cart
- Goes to checkout (
yourstore.com/checkouts/abc123) - UTM parameters lost during checkout
- 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:
-
GA4 → Admin → Data Streams → Your Shopify stream
-
Enhanced measurement → Ensure enabled:
- Page views ✅
- Scrolls ✅
- Outbound clicks ✅
- Site search ✅
- Form interactions ✅
-
Verify purchase events include campaign parameters:
- GA4 → Reports → Monetization → Purchase
- 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:
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:
-
GTM → Variables → New User-Defined Variable
- Variable type: URL
- Component Type: Query
- Query Key:
discount - Variable name:
Discount Code
-
GA4 → Admin → Custom definitions → Create custom dimension
- Dimension name:
discount_code - Scope: Event
- Event parameter:
discount_code
- Dimension name:
-
GTM → GA4 Event tag → Add event parameter:
- Parameter name:
discount_code - Value:
{{Discount Code}}
- Parameter name:
Result: GA4 reports show which campaigns used which discount codes and their revenue.
Measuring Campaign ROI in GA4
View Campaign Performance
Standard Report:
-
GA4 → Reports → Acquisition → Traffic acquisition
-
Add filter: Session source (select your campaigns)
-
Columns show:
- Users
- Sessions
- Engagement rate
- Conversions
- Total revenue
-
Calculate ROAS:
CodeROAS = 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
Custom Campaign Dashboard (Recommended)
Create dedicated dashboard for campaign analysis:
-
GA4 → Explore → Blank exploration
-
Dimensions → Add:
- Session source
- Session medium
- Session campaign
- Date
-
Metrics → Add:
- Users
- New users
- Sessions
- Conversions (purchase events)
- Total revenue
- Average purchase revenue
-
Filters:
- Session medium = email (or cpc, social, affiliate)
-
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.
How do I track sales from influencer posts if they don't use my link?
If influencers share your product organically without UTM links, those sales will appear as Organic Social (instagram / referral, etc.) in GA4. For accurate attribution:
- Always provide influencers with custom UTM links
- Use unique discount codes to cross-reference
- 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:
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:
- Customer bookmarked page without UTMs, returned later to purchase
- Checkout redirect stripped UTMs (see Issue 1 above)
- Customer manually typed URL (true direct traffic)
- Payment processor redirect removed UTMs
- 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:
- Ask customers "How did you hear about us?" during checkout
- Create custom "referral source" field in POS
- 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:
- Set up GA4 on Shopify (use built-in integration)
- Configure email platform UTMs (Klaviyo, Mailchimp)
- Add UTMs to all social, affiliate, and partner links
- Use auto-tagging for paid ads (don't use manual UTMs)
- Verify checkout attribution (purchase events show campaigns)
- Create campaign dashboard in GA4
- Calculate ROAS monthly and optimize spend
Next steps:
- Follow this guide to implement UTM tracking
- Run campaigns for 30 days with proper tracking
- Analyze results in GA4
- Shift budget to highest-ROI channels
- Repeat monthly for continuous optimization
Your Shopify store can grow 2-3x faster when you know which campaigns actually work.
Related Guides:
- Complete UTM Tracking Guide for GA4
- Email UTM Best Practices
- Shopify Checkout Stealing Attribution (Fix)
- Campaign Naming Conventions
External Resources:
- Shopify GA4 Setup Official Guide
- Klaviyo UTM Tracking Documentation
- Google Analytics 4 E-commerce Documentation
✅ 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
Join 2,847 marketers fixing their tracking daily