Show each Shopify client which channel drives their sales.
For agencies that build and market several client Shopify stores. Virling reads each store's orders through a custom app that can only read orders, credits every order to the channel and campaign of the visit before it, and keeps each store on its own site with a report you can brand and share. Open source under AGPL, hosted or self-hosted.
A Shopify client wants to know which ads, emails and posts sold products, and Shopify on its own does not tie an order back to the visit that started it. Virling makes that join per store, from two things you add to the client's store: a script with a short cart snippet in the theme, and a custom app token. For clients who take payment through Stripe instead, see client Stripe revenue by channel.
What Virling reads from a client's orders
The custom app has one scope, read_orders, and from each order Virling keeps only what attribution needs.
- Visitor ID.
virling_vidin the order's note attributes, put there by the cart snippet. It is the link between the order and the visit. - Amount and status. The total price and currency, the financial status, and successful refund transactions. Paid, partially refunded and refunded orders count, voided ones count as failed, and pending or authorized orders wait until they are paid.
- Date. The time the order was processed, or created when Shopify gives no processed time.
- Customer ID and email. The customer ID ties a repeat order to the customer's first one. The email is only compared with identify events from the client's site, for orders that arrive without a visitor ID.
- Source. An order whose source is
subscription_contract, a Shopify Subscriptions renewal, is marked as a renewal.
Line items, products, addresses and discount codes are ignored, and so are the UTM tags or landing page Shopify stores on an order.
See which channel paid for each client store
Built for agencies that market Shopify stores. Self-host Virling free under AGPL, or start on the hosted version with a 14-day free trial.
Who installs what in the client's store
Virling never signs in to the store, so it needs no staff or collaborator account of its own. The setup splits into two jobs.
- Theme code, by your developer. Whoever edits the client's theme, usually from your own staff or collaborator account, pastes the site's tag before
</head>intheme.liquid, with the cart snippet from the Shopify integration after it. - The custom app, by the client. Shopify limits who can create one, so it is usually the store owner or a staff member they allow to. In the Shopify admin it lives under Settings, Apps and sales channels, Develop apps. Give it only
read_ordersand install it. - The token and address, into Virling. The Admin API access token starts with
shpat_. It goes in the site's payment setup with the store'shttps://your-store.myshopify.comaddress, because the Admin API does not answer on a custom domain.
Theme script, not an app embed
Virling is not listed in the Shopify App Store, so there is no app embed to switch on in the theme editor. The tag and the cart snippet are plain code in theme.liquid, which means they belong to one theme. When the client publishes another theme, or installs a new version of theirs, check that the live theme still has both, and add them again if not. If a client is also comparing attribution apps, the Shopify attribution app checklist lists what to check before installing one.
A headless or Hydrogen store has no theme.liquid. There the tag goes in the <head> of app/root.tsx with Hydrogen's nonce, your Virling host is allowed in the content security policy, and the client's cart code sets the virling_vid attribute itself. Shopify in the docs has the code.
Carts made outside the storefront, such as cart permalinks, Buy Button embeds and orders from other sales channels, carry no visitor ID. Those orders can still match by email when the client's site sends identify events, and otherwise count toward revenue as Unattributed.
Set up a client store
- Add the site. Click + Add a site with the store's domain and timezone, then type the client's name under Client in site settings, so the store is grouped with that client's other sites on All clients.
- Add the theme code. Paste the tag and the cart snippet, open the store from a tagged link, add a product, and check that
/cart.jsshows avirling_vidattribute. - Connect the token. Paste the
shpat_token and the myshopify.com address into the payment setup. The first import reads the last 60 days of orders, new ones follow every minute, and refunds show up within a minute or two. - Place a test order. With the Bogus Gateway or Shopify Payments in test mode, order from the tagged visit with a new customer email, and check that the order shows the tagged channel in Payments.
- Send the report. Brand it under Client report, create a client link, and turn on the weekly email if the client wants it in their inbox. Tag the store's ad and email links with the UTM builder so campaigns show by name; see why Shopify orders show up as Direct.
What the monthly report shows for a store
Pick the month as the dashboard range. The Channels card gives each channel's visitors, revenue and revenue per visitor, and Payments lists the orders with the channel each was credited to, so you can open one and show the visits before it. A refund lowers its order on the order's date, so a month you already reported can drop when a buyer returns something later.
Repeat orders from the same customer, and Shopify Subscriptions renewals, keep the channel of that customer's first order. Shopify does not give Virling subscription status, so Retention judges Shopify customers by how recently they last paid. Add the client's monthly ad spend per channel in site settings to get Profit by channel, and see the client marketing report template and how to prove marketing ROI to clients for the rest of the monthly method.
When the store moves on
Keep a copy first: Download PDF saves the report, and the Read API returns the store's payments as JSON. Then Disconnect in site settings deletes the stored token, and the client deletes the custom app in their Shopify admin. Take the tag and cart snippet out of theme.liquid, or the cart code out of a headless store, and revoke the client link.
Frequently asked questions
How do agencies show Shopify clients which channel drives sales?
Each client store gets its own Virling site. The theme code stores a visitor ID on the cart, Shopify copies it onto the order, and a custom app token with only read_orders lets Virling read the order and credit the visit before it. The client opens the result from a branded link, with no login.
Does Virling need a staff account in the client's store?
No. Virling never signs in to Shopify. It reads orders with the custom app's Admin API token, and your own staff or collaborator account is only used to paste the theme code.
What happens to tracking when the client changes theme?
The tag and the cart snippet live in the theme.liquid of one theme. After the client publishes another theme, or a new version of theirs, check that the live theme still has both. Without them, new orders carry no visitor ID and show as Unattributed until the code is added back.
Can Virling change anything in a client's Shopify store?
No. The custom app has only the read_orders scope, so Virling cannot edit products, customers or orders, and from each order it keeps only the fields attribution needs.
What does the client see when Virling and the ad platform disagree?
Only Virling's numbers, since no ad platform is connected. Virling counts the orders it reads from Shopify, net of refunds, and gives each one to a single visit under the site's model and lookback window, last non-direct over 90 days unless you change it. An ad platform counts by its own rules, so expect the two to differ, and use the same model on every client's site.
How many months of Shopify orders load at the start?
About two. The first import reads orders from the last 60 days, the most Shopify gives without an extra permission, then new ones every minute. Orders from before the snippet was on the store count as revenue but are Unattributed, unless their email matches.
More detail: Shopify in the docs and Run Virling for client sites.