virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
blog / 2026-11-24

Ecommerce attribution: a plain guide for store owners

By Devendra Variya, co-founder of Virling. Published 2026-11-24.

Ecommerce attribution means crediting each order in your store to the visit that led to it, so you know which ads, emails, searches and posts bring orders. It works when three things are joined: the visit and its source, a visitor ID on the order, and the order itself, read from your store with its refunds. Start from your real orders, not from what each ad platform claims, because platforms count the same order more than once. Some orders can never be linked to a visit, so keep them on a line of their own.

This guide covers the decisions. What Virling shows a store is on the ecommerce page, and the setup is in set up an online store.

What attribution means for a store

Your store knows what sold, for how much and to whom. It often does not know why that person came. Analytics has the opposite problem: it sees the visit and its source, but not whether the order was paid, refunded or repeated. Attribution joins the two, and three kinds of question come out of it:

  • Where do orders come from? Orders and revenue per channel, source and campaign.
  • Is a channel good or only busy? Revenue per visitor, average order value by traffic source and refunds, next to what the channel costs.
  • Who found the customer? The channel of the first order, for buyers who come back.

What it does not prove is that the channel caused the order. Someone who clicked your ad might have bought without it. Attribution tells you which visit came before the order, which is enough to spot a channel that sends visitors and no orders.

Why ad platforms claim more orders than you had

An ad platform answers a different question: how many buyers had contact with one of its ads. Several platforms can say yes about the same order.

  • Nobody removes the overlap. A buyer who clicked two ads and a newsletter before ordering can be claimed by all three tools. Each is following its own rule.
  • Views can count. Meta, for example, can credit a purchase within 1 day of someone seeing an ad, without a click (Meta, about the attribution setting).
  • Windows differ. A platform with a 7-day window and one with a 30-day window are not counting the same thing.
  • Refunds come later. A purchase event is sent when the order is placed, so a return two weeks on may not reach the report.

The table below is a made-up store with 100 orders of $60 in a month. The left count is what each tool claims, and the right count credits every order once.

Made-up numbersOrders claimedOrders credited once
Ad platform A4631
Ad platform B3317
Email tool4118
Organic searchNo one claims it15
DirectNo one claims it7
UnattributedNo one claims it12
Total120100

Three tools claim 120 orders out of 100 and leave nothing for search or Direct. A quick check that needs no tracking is the marketing efficiency ratio: all revenue divided by all marketing cost. If this store spent $1,500, that is $6,000 / $1,500 = 4x. The MER calculator compares it with your break-even. It tells you whether marketing pays as a whole, and attribution tells you which part of it does.

To compare one platform with your orders campaign by campaign, follow why Meta Ads purchases do not match Shopify orders. Email has the same gap for a different reason, explained in email revenue tracking for stores.

Which orders can be linked, and which cannot

An order is linked when it carries an ID that belongs to a visitor. Virling puts that ID in a first-party cookie, virling_vid, and reads it back from the order. Where it travels depends on what you sell with:

StoreCan be linkedUsually cannot
ShopifyOrders from a cart on your storefront, guests included, when the cart carries the visitor ID. Headless stores too, if your cart code sets it, as in Shopify Hydrogen UTM trackingCart permalinks, Buy Buttons and other sales channels. A button that skips the cart may leave the ID out, so test each one
WooCommerceOrders from the classic and the block checkout, guests included, when the snippet saves the ID on the orderOrders created in the admin or by another system, and gateways or express buttons that create orders outside those two checkouts
StripeCheckout Sessions and PaymentIntents your server creates with the ID, and buy.stripe.com Payment Links clicked on a page that runs the scriptPayment Links opened from an email, a QR code or another site, or on a custom domain

On all three, an order with no visitor ID can still be matched by email, if your site sent that buyer's email as an identify event before the order was synced and the two match exactly. Orders made before you set this up mostly stay unlinked. So do buyers who block the script, stores in cookieless mode, and orders whose visits all fall outside the window.

Keep two leftovers apart. Direct is an order with a known visit that had no readable source. Unattributed is an order with no visit that can be tied to it. Direct shrinks when you tag links; Unattributed shrinks when checkout carries the ID. If your store's own report is full of unknowns, see Shopify orders that show as Direct or WooCommerce orders that say Unknown. Buyers who click on a phone and order on a laptop are covered in cross-device attribution.

Choose a model and a window

A model decides which visit gets the order when there were several. Here is a made-up $80 order with four visits from one browser:

Made-up visitFirst touchLast non-directLast touch
Day 1: Instagram ad$80$0$0
Day 12: Google search$0$0$0
Day 18: email link$0$80$0
Day 20: typed the address, ordered$0$0$80
  • Last non-direct is a good default for a store. It ignores the typed address and credits what brought the buyer back.
  • First touch shows who introduces buyers. Check it before you cut prospecting ads or creators, since those rarely come last.
  • Last touch shows how people arrive when they are ready to buy, Direct included.

Rules that split one order, such as linear, are in multi-touch attribution; Virling does not offer them yet. The window is how far back a visit can earn credit. Use 30 days when most orders follow within days of the first visit, and 60 or 90 for expensive or seasonal products people compare for weeks. More on that in attribution windows.

Whatever you choose, use it for every channel and write it down. In Virling the model and window are set per site, and changing either recomputes past orders, so you can compare two views of the same month.

Returns and repeat orders

A channel that sells a lot of what comes back is not doing as well as its sales say. Take a refund off the order it belongs to, on that order's date, and charge it to the channel that brought the sale. Virling reads refunds rather than return requests, so a return counts once you refund it: within a minute or two on Shopify, and within 6 hours on WooCommerce for orders from the last 60 days. Wait until your return window has passed before you judge a month, then compare refund rate by traffic source.

Repeat orders need a rule, because the channel that found a buyer is often not the one that brought them back. Virling credits a later order by the same customer ID to the channel of their first order in Virling, if that order was credited to a visit. Three things follow:

  • Channels that find loyal buyers look better over time, which is the point.
  • Email that brings people back gets no revenue for those orders. Judge it with your email tool's own report. The two ways to count are side by side in new vs returning customer revenue.
  • Old customers look new at first. The first import reads 60 days of Shopify orders, or 90 days from WooCommerce and Stripe. A customer who first bought before that starts again from their next order, unless the store marks it as a subscription renewal, which usually stays Unattributed. A WooCommerce guest counts as a new customer each time.

A first-week plan

  1. Day 1: write down the gap. For the last full month, note your store's orders, revenue and refunds, all marketing cost, and the orders each platform claims. Work out your MER. If your store reports carts, work out your cart abandonment rate from carts and orders too.
  2. Day 2: tag what you control. Ads, email, SMS, bio links and creator links, with one naming rule. The UTM builder makes the links, and which UTM parameters to use has the rule.
  3. Day 3: put the visitor on the order. Add the script, connect the store with a read-only key and add the checkout step for your platform, as in the store setup guide.
  4. Day 4: test every way to pay. From a tagged link in a private window, place an order with each button you offer, and check that it shows the tag as its source. Test your setup has the steps.
  5. Day 5: set the model and window. Start with last non-direct and the window that fits your product, then leave both alone for a month.
  6. Day 6: read ten orders. Open ten real orders and look at the visits before each. Then take the orders with no visit and fix their most common cause.
  7. Day 7: decide what will change your mind. Write the rule now, such as the cost per kept order above which you cut a campaign, and the date you will look. One week of orders is too few to move a budget on.

After one full return window, put the day 1 numbers next to the new ones. The total should be close to your store's paid orders. The split between channels is what you did not have before. To turn a monthly target into the orders and visitors it takes, use the store revenue goal calculator.

Start free trial

Frequently asked questions

What is ecommerce attribution?

Crediting each order, and its revenue after refunds, to the visit that led to it, so you can see which ads, emails, searches and posts bring orders. It needs three things joined: the visit with its source, the visitor on the order, and the order from your store.

Why do ad platforms report more orders than my store had?

Each platform counts orders it had some contact with, inside its own window, without seeing the other platforms. One buyer who clicked two ads and an email can be claimed three times. Some platforms also count people who only saw an ad. Your store has one order.

Which attribution model is best for an online store?

Last non-direct is a sensible start: the latest visit that was not Direct gets the order. Compare it with first touch before you cut a channel, because first touch shows which channels introduce buyers. Use one model for every channel at a time.

What attribution window should a store use?

30 days when most orders follow within days of the first visit. Use 60 or 90 days for expensive or seasonal products that people compare for weeks. Pick a window comfortably longer than your buyers usually take.

Can every order be attributed?

No. Orders from other sales channels, orders typed in by staff, buyers who block tracking and buyers who switch devices often have no visit to credit. In Virling they still count toward revenue and are listed as Unattributed.

Who gets the credit for a repeat order?

There are two fair rules: the channel of the first order, or the visit right before the repeat order. Virling uses the first when the customer has a customer ID and their first order was credited to a visit. A guest order is credited to its own visit.

See which channels bring your store orders

Virling is open source under AGPL. Self-host it free, or use the hosted version with a 14-day free trial. It connects to Stripe, Paddle, Shopify, WooCommerce, Polar, LemonSqueezy, Dodo, Creem and RevenueCat.

Start free trial See the demo