attribution shopify marketing-analytics order-tracking channels

Shopify Order Attribution: How to See Which Channel Drove Each Sale

Detectly Team

You are spending money across Meta Ads, Google Ads, email, influencers, and organic social. Orders are coming in. But when you look at a specific order in Shopify, can you tell which channel drove it?

For most merchants, the answer is no — or at best, “sort of.” Shopify provides some session-level attribution data, but it falls short of giving you a reliable, order-level view of which marketing efforts are actually generating revenue.

This guide explains why Shopify’s native attribution is limited, what your options are for getting better data, and how to set up order-level attribution that tells you exactly where each sale came from.

What Shopify Tells You (and What It Doesn’t)

Session Source vs. Order Source

Shopify’s analytics reports show you session data — where your website visitors came from. You can see traffic by referrer, by UTM source, or by channel grouping (Direct, Social, Search, etc.).

But session data and order data are not the same thing. Consider this scenario:

  1. A customer clicks your Meta ad on Monday (Session 1: Meta / paid_social).
  2. They browse your store but do not buy.
  3. On Wednesday, they Google your brand name and visit your store (Session 2: Google / organic).
  4. They add to cart but leave.
  5. On Friday, they open your abandoned cart email and complete the purchase (Session 3: Klaviyo / email).

Which channel gets credit for that order? The answer depends on your attribution model. Was it Meta (first touch), Klaviyo (last touch), or some combination? Shopify does not give you a clear answer at the order level.

The Order Details Page

When you open an order in the Shopify admin, you see a “Conversion summary” section that shows some attribution data. This includes the landing page, referrer, and UTM parameters from the session that led to the order.

However, this data has significant limitations:

  • It only reflects the last session. If the customer visited three times before purchasing, you only see the final visit’s data.
  • It is frequently blank. Direct traffic, bookmarks, and many mobile app referrers produce empty attribution fields.
  • It is not exportable. You cannot easily pull this data out of Shopify for analysis in a spreadsheet or BI tool without using the API.
  • No campaign-level detail. Even when a source is shown, campaign, ad set, or ad-level granularity is rarely available.

Shopify Reports

Shopify’s built-in reports (under Analytics > Reports) include a “Sessions by referrer” and “Sessions by traffic source” report. These are useful for understanding traffic patterns, but they show session counts, not revenue attribution.

The “Sales by traffic referrer” report attempts to connect revenue to sources, but it uses last-click session data and frequently attributes a large percentage of revenue to “Direct” or “Unknown” — neither of which helps you make marketing decisions.

Why Order-Level Attribution Matters

Session-level data tells you where traffic comes from. Order-level attribution tells you where revenue comes from. The difference matters because:

Budget allocation. If Meta Ads drives 40% of your sessions but only 20% of your revenue (because those visitors browse but don’t convert at the same rate), you need to know that before increasing your Meta budget.

Campaign optimization. Knowing that your “summer collection” campaign on Meta generated 150 orders worth $12,000 — while your “retargeting” campaign generated 80 orders worth $9,500 — lets you optimize spend at the campaign level, not just the channel level.

Partner and influencer payouts. If you work with influencers or affiliates, you need to attribute specific orders to specific partners. Session data is not precise enough for commission calculations.

Customer segmentation. Understanding which channel acquired each customer lets you build segments for retention marketing. Customers acquired through Meta may behave differently than customers acquired through Google Search.

Methods for Order-Level Attribution

Method 1: Manual UTM Tracking with Cart Attributes

The most basic approach is to capture UTM parameters when a customer arrives and attach them to the order using Shopify’s cart attributes.

The process:

  1. Add JavaScript to your theme that reads UTM parameters from the URL.
  2. Store UTM values in a cookie (to persist across pages).
  3. Before checkout, write the cookie values into hidden cart attribute fields.
  4. These attributes appear on the order in the Shopify admin.

Pros: Free, no app required.

Cons: Cart attributes are unstructured text fields. They are hard to query, export, and analyze. You need to maintain the JavaScript yourself, and changes to your theme or checkout flow can break it.

Method 2: Order Metafields via Shopify API

A more robust approach is to write attribution data to order metafields after the order is placed. Metafields are structured, typed data fields that live on the order record and can be queried via the Shopify API, displayed in the admin, and included in exports.

The process:

  1. Capture UTM parameters on the storefront (same as Method 1).
  2. Pass them to your backend when the order is created (via a webhook or checkout extension).
  3. Write the attribution data to order metafields using the Shopify Admin API.

Pros: Structured data, queryable, visible in order details.

Cons: Requires backend infrastructure, webhook handling, and API authentication. You are essentially building a small attribution app.

Method 3: Using an Attribution App

Attribution apps handle the entire pipeline — UTM capture, session persistence, order matching, and data writing — without requiring you to build or maintain anything.

When evaluating an attribution app, look for:

  • Order metafield storage. The app should write attribution data to metafields, not just display it in the app’s own dashboard. Metafields are portable — they work with Shopify’s native exports, other apps, and the API.
  • First-touch and last-touch data. Ideally, the app captures both the first touchpoint (how the customer discovered you) and the last touchpoint (what brought them back to buy).
  • Customer tagging. Writing the acquisition channel to customer tags enables segmentation in email platforms like Klaviyo.
  • Reliable capture. The app should handle edge cases like cross-device visits, returning customers, and mobile in-app browsers.

How Detectly Handles Order Attribution

Detectly writes structured attribution data directly to Shopify order metafields on every order. When a customer places an order, Detectly attaches:

  • utm_source, utm_medium, utm_campaign, utm_content, and utm_term
  • The landing page URL
  • The referring URL
  • A channel classification (e.g., “Meta Paid Social,” “Google CPC,” “Klaviyo Email”)

This data appears in the order details in your Shopify admin and is accessible via the API and exports. Because it lives on the order as structured metafields, you can use it with any reporting tool, BI platform, or Shopify Flow automation.

Detectly also tags customers with their acquisition channel, so you can build segments in Klaviyo or your email platform based on how each customer was acquired.

Building Attribution Reports

Once attribution data lives on your orders, you can build reports that answer the questions that matter.

Revenue by Channel

Group orders by their utm_source and utm_medium to see which channels drive the most revenue:

ChannelOrdersRevenueAOV
Meta / paid_social342$28,450$83.19
Google / cpc218$21,670$99.40
Klaviyo / email187$15,230$81.44
Direct / none156$12,890$82.63
Instagram / influencer43$4,120$95.81

Revenue by Campaign

Drill into a specific channel to compare campaign performance:

CampaignOrdersRevenueAd SpendROAS
retarget_atc_apr202689$7,340$1,2006.1x
prospecting_lal_1pct142$11,800$4,5002.6x
spring_collection_launch111$9,310$3,2002.9x

New vs. Returning Customer Acquisition

Segment orders by whether the customer is new or returning, then look at which channels acquire new customers most efficiently:

ChannelNew CustomersCACReturning Customers
Meta / paid_social203$22.17139
Google / cpc156$19.8762
Klaviyo / email12175

This reveals that Klaviyo drives almost entirely repeat purchases (expected for email), while Meta and Google are your primary acquisition channels.

Common Attribution Pitfalls

Over-Reliance on Last Click

Last-click attribution gives all credit to the final touchpoint before purchase. This systematically undervalues top-of-funnel channels (like prospecting ads or organic social) and overvalues bottom-of-funnel channels (like branded search, retargeting, and email).

Be aware of this bias when making budget decisions. A prospecting campaign that introduces customers to your brand may look unprofitable on a last-click basis, even though it fills the top of your funnel.

Ignoring “Direct” Traffic

A large percentage of “Direct” traffic is actually misattributed. These are often customers who:

  • Clicked an ad in a mobile app (Instagram, TikTok) where the referrer is not passed
  • Used a browser that strips referrer data
  • Clicked an untagged link in an email or SMS

Reducing your “Direct / Unknown” bucket starts with tagging every link you control with UTM parameters.

Not Tagging Automated Flows

Abandoned cart emails, welcome series, and post-purchase flows frequently generate significant revenue. If these links are not UTM-tagged, that revenue shows up as “Direct” and you cannot see the true contribution of your automated marketing.

Comparing Apples and Oranges

Do not compare Meta’s reported ROAS (from Ads Manager) with your order-level ROAS (from attribution data) and expect them to match. They use different attribution models, different lookback windows, and different data sources. Both are useful, but they answer different questions.

Getting Started

If you are starting from zero, here is a practical path to better order attribution:

  1. Tag everything with UTMs. Every ad, email, SMS, influencer link, and social post should have proper UTM parameters. This is the foundation.

  2. Capture UTMs on your storefront. Either add custom JavaScript or install an attribution app that handles this automatically.

  3. Write attribution to order metafields. Structured data on orders is far more useful than session-level analytics.

  4. Build a weekly channel report. Even a simple spreadsheet showing revenue by source/medium gives you actionable insight.

  5. Review and adjust monthly. Use attribution data to shift budget toward channels with the best return, pause underperforming campaigns, and double down on what works.

Wrapping Up

Shopify gives you the tools to run a store, but its native attribution is not designed to answer the question every marketer needs answered: “Which of my marketing efforts are actually driving revenue?”

Getting order-level attribution right requires capturing UTM data, persisting it through the customer journey, and writing it to the order record in a structured way. Whether you build this yourself or use a purpose-built tool like Detectly, the result is the same — every order tells a story about where that customer came from and what brought them to buy.

That story is the foundation of every smart marketing decision you will make.

Ready to see your true ROAS?

Detectly tracks every UTM, attributes every Shopify order, and shows you which channels actually drive revenue.