DATALYR
Shopify5 min read

Track every Shopify order back to the ad that drove it

Shopify checkout is a black box between the click and the sale. Here's how a visitor ID threaded through the cart matches 90%+ of orders back to the exact ad that drove them.

MikaGrowth @ DATALYR
Shopify

A shopper clicks your Meta ad, lands on a product page, pokes around, adds to cart, and buys two days later from their phone on the couch. By the time Shopify records the order, the fbclid from that first click is long gone — stripped somewhere between the landing page and the checkout domain. So the order shows up in your Shopify admin as revenue with no idea where it came from.

Why Shopify loses the click

Shopify checkout runs on its own surface, isolated from your storefront. Click IDs and UTMs live in the URL of the ad-landing page; they don’t automatically survive into the order object. Most stores paper over this with email matching— link the order’s email back to a session that had the same email — which gets you 70–85% coverage and quietly drops every guest checkout and every shopper who used a different email.

The click and the sale are real. The thread between them is what gets cut.

Thread a visitor ID through the cart

DATALYR’s Shopify app installs a first-party script that captures the click IDs and UTMs the moment someone lands, and ties them to a durable visitor ID. That ID gets written onto the cart as a note_attribute, so it travels all the way into the order. When Shopify fires the orders/paid webhook, DATALYR reads note_attributes['_datalyr_visitor_id'] and matches the sale directly back to the first click — no email guesswork.

For standard Online Store 2.0 themes this is automatic; the Web Pixel handles it. Headless and Hydrogen storefronts set the same cart attribute manually via the Storefront API. Either way the result is a direct visitor-ID match — the 90%+ path, not the 70–85% email fallback.

Then send the revenue back

Once the order is matched, DATALYR forwards a single, deduplicated purchase conversion — valued from the real Shopify order, not a client-side estimate — server-side to Meta, Google, and TikTok. Your ad platforms optimize toward actual paid orders, and refunds and cancellations flow through the same webhooks so your numbers don’t stay inflated after a return.

  • Install from the Shopify App Store — pixel, theme embed, and webhooks auto-configure.
  • A 30-day order backfill runs on connect, so you see attributed history immediately.
  • Conversion rules map purchase events to each ad account.

The full walkthrough is in the Shopify setup guide — about five minutes, no theme code required.

Ready to scale faster?

Track the full journey from ad click to revenue, and optimize with server-side conversions.