Skip to main content
When SourceMedium receives an order, we often have UTM attribution data from multiple sources—Shopify customer visits, order notes, website event tracking, and Google Analytics. The attribution source hierarchy determines which source “wins” when data is available from multiple places.
This is a last-touch attribution system. We prioritize data sources that capture the customer’s most recent touchpoint before purchase.

Primary Attribution Source Hierarchy

The order attribution system evaluates data sources in this specific priority order:
PrioritySource TypeDescription
1Shopify Last Customer VisitThe final tracked visit before order placement, captured by Shopify’s customer visit tracking
2Shopify Landing SiteUTM parameters extracted from the order’s landing page URL
3Shopify Order NotesUTM data written to order notes by tracking tools (Elevar, Blotout, etc.)
4Website Event TrackingFirst-party event pixels from GA4, Elevar, or other website analytics
5Shopify First Customer VisitThe customer’s first tracked visit, captured by Shopify’s customer visit tracking
6GA4/Universal AnalyticsTransaction data from Google Analytics platforms
7Shopify Order Referring Site UTMsUTM parameters parsed from the order’s referring_site URL
If data is missing at priority 1, the system “falls” to priority 2, and so on until it finds valid UTM data.
Why does “Last Customer Visit” beat “First Customer Visit”?Because we’re building a last-touch attribution model. The most recent touchpoint before purchase (last visit) is more relevant for understanding what drove the conversion than the first touchpoint (which may have been weeks earlier).

Website Event Tracking Details

For website event tracking sources (priority 4), the system uses qualifying events within a 90-day lookback window before the order. When multiple events exist, they’re ranked by:
  1. Days between event and order (closer to order = higher priority)
  2. Event timestamp (earlier event_local_datetime wins ties)
  3. Event ID and source system (as final tie-breakers)
If a website event has a UTM source, that’s used directly. If only a referrer domain is available, the source is inferred from the domain and the medium defaults to referral.

Shopify Order Notes (Priority 3)

Order notes are a key source for attribution data written by server-side tracking tools like Elevar and Blotout. These tools capture UTM parameters at checkout and write them to Shopify order notes.

For Shopify V2 (Legacy)

The system extracts UTM data from note attributes with these keys:
  • utm_source, utm_medium, utm_campaign, utm_content, utm_term, utm_id
  • _elevar_visitor_info (parsed for nested UTM data)
  • _source, _attribution

For Shopify V3 (GraphQL API)

The new customAttributes field has its own sub-priority system:
Sub-PrioritySource TypeExample Keys
1Direct UTM keysutm_source, utm_medium, utm_campaign, etc.
2Parsed from aggregate fieldsutmParams, GE_utmParams (URL query string format)
3Inferred from click IDsgclid → google, fbclid → facebook, etc.
When the same order has both a direct UTM key and the same key parsed from an aggregate field, the direct key wins.

Click ID to Channel Inference

When only a click ID is present (no explicit utm_source), the system infers the channel:
Click IDInferred ChannelChannel Priority
gclidgoogle10 (highest)
fbclidfacebook20
ttclidtiktok30
msclkidmicrosoft40
irclickidimpact50
scclidsnapchat60 (lowest)
If an order has multiple click IDs (e.g., both gclid and fbclid), the channel priority determines which one is used to infer utm_source.
Click IDs are fallback only. If an explicit utm_source exists, it takes precedence over any click ID inference.

Allowlisted Attribution Keys

Only specific keys are extracted from order notes and custom attributes. This prevents accidental capture of non-attribution data:
  • utm_source, utm_medium, utm_campaign, utm_content, utm_term, utm_id
  • utmParams, GE_utmParams (aggregate query string fields)
  • _source, _attribution
Click IDs are not allowlisted for raw extraction. Instead, when click IDs (gclid, fbclid, ttclid, etc.) are present, they’re used only to infer a fallback channel-level utm_source value (e.g., gclidgoogle). The raw click ID values are not stored as attribution data.

UTM Field Collapsing

After the primary source is determined, the system “collapses” supplementary UTM fields from lower-priority sources. Example: If priority 1 (Last Customer Visit) provides utm_source=google but no utm_campaign, and priority 2 (Landing Site) has utm_campaign=summer_sale, the final attribution will combine:
  • utm_source=google (from priority 1)
  • utm_campaign=summer_sale (from priority 2)
This only happens when the utm_source grouped channel is the same across sources—we don’t mix data from different channels.