virling Pricing Self-host Demo Changelog Agencies GitHub Start free trial
integrations / stripe for ecommerce

See which channel brings your Stripe orders.

For online stores that take payments through Stripe Checkout or Payment Links, without Shopify or WooCommerce. Virling ties each order to the channel and campaign that brought the buyer, so you see orders and revenue by traffic source, not just a list of charges. Open source under AGPL, hosted or self-hosted.

Start free trial See the demo

Stripe records the charge but not the visit before it, so a store's orders look like they came from nowhere. Virling sets a visitor ID when a shopper lands, carries it into Stripe at checkout and joins the order to the visits before it, as Link checkout to visits explains.

What you get

  • Orders by channel, for physical or digital goods. An order placed through a Checkout Session or a Payment Link is credited to a visit with its channel, source, UTM campaign and landing page. Its revenue is the full charge, so shipping and tax collected at checkout are included.
  • Orders you capture when they ship. A charge you authorize at checkout and capture later is imported once it is captured, dated when the shopper paid. If you capture less than you authorized, the rest counts as refunded.
  • Repeat orders on the first channel. A later order by the same Stripe customer keeps the channel of their first order, and the Retention page groups buyers by it, so you see which channels bring shoppers who order again. Checkout in payment mode creates a Customer only when required, so set customer_creation: "always" to link a returning guest's orders.
  • Returns and chargebacks. A refund lowers the order's revenue on the order's date, and a dispute that closes as lost counts as refunded, while an open one changes nothing. The Refunded column on the Channels card shows the share of each row's orders refunded in whole or part.
  • Invoiced orders. A custom or wholesale order billed with a Stripe invoice is imported when the invoice is paid with a charge. It has no Checkout Session to read, so put metadata.virling_vid on the charge or its PaymentIntent.
  • Average order value by channel. The dashboard shows revenue and revenue per visitor, not order value. virling query channels --json and the Read API return each channel's payments and net revenue, and revenue divided by payments is its average order value.

See your Stripe orders by channel

For online stores that take payment through Stripe. Virling is open source under AGPL: self-host it free, or use the hosted version with a 14-day free trial.

Start free trial See the demo

Set it up

Put the script on every page of your store, connect Stripe with a restricted key that can only read, and pass the virling_vid cookie as client_reference_id on each Checkout Session your server creates; Payment Links on buy.stripe.com get it from the script with no code. The key's permissions, the fields Virling reads the ID from and a test-mode check are in Stripe in the docs.

await stripe.checkout.sessions.create({
  mode: "payment",
  client_reference_id: req.cookies.virling_vid,
  customer_creation: "always",
  // ...
});

Stores that sell through links can follow Stripe Payment Link UTM tracking, and how to track Stripe revenue by traffic source walks through a server checkout. To compare order values by hand, use the average order value calculator.

Reading it in the first week

Pick Since tracking started so orders imported from before the script do not bury the new ones. A week of orders is a small sample, so read a row with a few orders as a hint.

  1. Do new orders carry a visitor? Filter the Payments page by unattributed and open a recent order. If Visitor is missing under Details, your checkout dropped the ID; fix that before you trust the channel numbers.
  2. Which campaign sells after returns? On the Channels card, open the Source and Campaign tabs and read revenue per visitor next to Refunded. A campaign whose orders come back is not selling, however busy it looks.
  3. Which product page closes the sale? On the Pages card, Landing page shows where buyers entered and Before paying shows the last page before the order. Link your next campaign to the page that sells.

What stays Unattributed

An Unattributed order still counts toward revenue. On a Stripe store the usual causes are:

  • A checkout created without the ID. Make sure the server code that creates the Checkout Session or PaymentIntent reads the cookie from that same request.
  • Your order number in client_reference_id. Virling would read it as a visitor ID. Leave the order number where it is and add the cookie as metadata.virling_vid, which wins.
  • Payment Links printed or sent away from your site. A link on a packing slip, a QR code, an email or a custom domain carries no visitor ID. Send buyers to the product page and link to Stripe from there.
  • Invoices without the ID. An invoice outside a subscription is matched only through the charge or PaymentIntent metadata, or by email.
  • Orders from before the script. Imported history usually stays Unattributed, and there is nothing to fix.

If a shopper creates an account before checkout, send their email as an identify event, and a later order whose billing or receipt email matches is credited to them. See Recover payments by email.

What to know

  • The first import reads 90 days of charges. A refund made after you connect still counts, even on an older order.
  • A shopper coming back from Stripe Checkout does not start a new session, so the visit before the order keeps the credit.
  • Orders without a Stripe customer are grouped by visitor on the Retention page, so a buyer on two devices can count twice.
  • Revenue is before Stripe fees. Add a fees line such as Fees 2.9% + 0.30 under monthly spend, and the Profit by channel card takes the fixed part off every order, which matters most on small baskets.

Open source

Virling is open source under AGPLv3 on GitHub, and you can self-host it or use the hosted service. The Stripe import is the same in both, as described in Stripe in the docs.

Frequently asked questions

How do I see Stripe orders by traffic source?

Add the Virling script to your store, connect Stripe with a read-only restricted key, and pass the visitor ID into Checkout as client_reference_id. Payment Links on buy.stripe.com need no code. Each order is then credited to the visits before it, and the Channels card shows revenue and revenue per visitor for every channel, source and campaign.

Do Stripe Payment Links need any code?

No. When a visitor clicks a buy.stripe.com link on a page that runs the script, the script adds client_reference_id with their visitor ID, unless the link already has one. Links opened from emails, QR codes or other sites carry no visitor ID and show as Unattributed.

Are refunds and disputes counted?

Yes. Virling reads Stripe events for refunds, lost disputes and late settlements, and updates orders it has already imported.

Does Virling need write access to Stripe?

No. It asks for a restricted key with Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents, and refuses secret keys.

Which channel gets credit for a repeat order?

A later charge of the same Stripe customer keeps the channel of that customer's first payment, whatever visit came before it. If the first payment is Unattributed, the repeat order falls back to its own visitor ID. Payments without a Stripe customer ID cannot be linked to a first payment, so each one is credited by its own visits.

Are orders paid by Stripe invoice tracked?

Yes, when the invoice is paid with a charge. One marked as paid outside Stripe has no charge and is not imported. For an invoice without a subscription, Virling reads only the metadata of the charge and its PaymentIntent, so set metadata.virling_vid there or match the payment by email.

Can I test it with Stripe test mode?

Yes. With an rk_test_ key, Virling reads test charges and refunds, and the script adds the visitor ID to test Payment Links on buy.stripe.com too. A site has one Stripe connection, and test payments stay in your reports after you replace the key with a live one. Use a new customer for each test, because a later payment by the same customer keeps the first payment's channel.

Can I see average order value by channel?

Not as a dashboard number. The Read API breakdown and virling query channels --json return payments and net revenue for each channel, and revenue divided by payments is that channel's average order value, after refunds and before Stripe fees.

Full guides: Stripe in the docs, Link checkout to visits and Set up Virling for an online store.

Start free trial