How to add attribution_source to Shopify orders (without breaking checkout)
Every Shopify operator hits the same wall: you can see in Meta Ads Manager that a customer clicked your ad, but when the order lands in Shopify Admin, you can't tell which campaign it came from. The order has no attribution_source field, no utm_source, nothing reliable.
Shopify's data model just doesn't include this by default. You have to put it there yourself. Here are the three working approaches, ranked by how much technical work each requires.
Option 1: Shopify Customer Events extension (no code)
Shopify's Customer Events feature lets you write JavaScript pixels that run in a sandboxed Web Worker on every page. Use it to capture utm_source / utm_medium / utm_campaign from the URL on landing, store them in a first-party cookie, then attach them to the order via the checkout API's note_attributes.
This is the cleanest path because no theme code changes, no checkout.liquid changes, and Customer Events is officially supported by Shopify Plus AND non-Plus stores.
Option 2: note_attributes via cart attributes (light code)
If you're not on Customer Events, you can add hidden input fields to your cart form that capture utm_* and pass them as cart attributes. They land on the order's note_attributes JSON.
<input type="hidden" name="attributes[utm_source]" value="" data-utm-source>
<input type="hidden" name="attributes[utm_medium]" value="" data-utm-medium>
<input type="hidden" name="attributes[utm_campaign]" value="" data-utm-campaign>
<script>
const params = new URLSearchParams(window.location.search);
document.querySelector('[data-utm-source]').value = params.get('utm_source') || '';
document.querySelector('[data-utm-medium]').value = params.get('utm_medium') || '';
document.querySelector('[data-utm-campaign]').value = params.get('utm_campaign') || '';
</script>Option 3: Server-side attribution via a third-party tool
Tools like Triple Whale, Northbeam, and Elevar capture click IDs server-side and stitch them to orders post-purchase. This is the most accurate but also the most expensive: $179-$599 per month for the right tier.
If you're at sub-$1M ARR, options 1 or 2 will get you 90% of the value at 0% of the recurring cost.
How to verify it worked
In Shopify Admin, open any recent order and look at the Additional Details section. You should see your attribution fields listed there. Alternatively, query the Admin API for the order's note_attributes array.
A DataGap audit reads a sample of your recent orders and reports the exact attribution_source coverage. If 60% of your orders are missing it, you find out in ten minutes.
DataGap connects to your Shopify store via read-only OAuth and returns a ranked list of tracking gaps in 10 minutes. $167 one-time. No subscription.
Run a free auditFrequently asked
Partially. source_name tells you the high-level surface (web, pos, draft_order, shopify_draft_order) but not the marketing channel. You still need utm_* to know whether the conversion came from Meta, Google, organic, or email.
Customer Events runs in a sandbox and can't break checkout. The hidden-input approach is also safe; the field just becomes a no-op if the value is empty. Don't modify checkout.liquid directly.