Web to app revenue attribution: Stripe sales by channel.
For apps that sell on the web through Stripe Checkout or Payment Links before the install. Virling puts the visitor ID on the Stripe checkout and credits each payment and renewal to the ad, post or search that brought the buyer. Open source under AGPL, hosted or self-hosted.
A web to app buyer pays on your site first and opens the app after. Stripe knows who paid, but not the visit that came before. Virling joins the two with a read-only key. Store installs and in-app purchases that never touch the web have no visit to credit.
What you get
- Each web sale credited to a channel. The payment is joined to the visits before it. By default it goes to the latest visit in the last 90 days that was not Direct.
- Trials that convert. A trial start, a
checkout.session.completedevent with a total of 0, is never counted as revenue, a payment or a customer. The customer's later payment is credited to the visits before the trial started. A paid trial is a payment like any other. - Renewals that keep the first channel. A charge whose invoice has billing reason
subscription_cycleis a renewal. It copies the channel, referrer, campaign, landing page, country and device of the customer's first payment, matched by Stripe customer ID, even though the renewal happens long after the install and has no visit. - Refunds and disputes. Refunds and lost disputes update payments that were already imported.
- MRR. The list price of live subscriptions per month in USD, past any trial, shows on Latest payments.
See which channel brings your web buyers
For mobile apps that sell on the web through Stripe. Virling is open source under AGPL: self-host it free, or use the hosted version with a 14-day free trial.
Where the visitor ID goes
The script sets the virling_vid cookie on your registrable domain, so a site on yourapp.com and a paywall on pay.yourapp.com share one visitor ID. It has to reach Stripe on the checkout:
| How you sell | Where the ID goes |
|---|---|
| Checkout Session | client_reference_id, or metadata.virling_vid if you already use that field |
Payment Link on buy.stripe.com | No code: the script adds client_reference_id when it is a normal link on a page that runs the script |
| Your own PaymentIntent (Elements) | metadata.virling_vid |
await stripe.checkout.sessions.create({
mode: "subscription",
client_reference_id: req.cookies.virling_vid,
// ...
});Set it up
- Add the site. Click + Add a site and enter your domain, such as
yourapp.com, and its timezone. - Install the script. Paste the tag before
</head>on every page of your marketing site and web paywall. Leave cookieless mode off: without the cookie there is no visitor ID to pass on. - Pass the visitor ID. Use the table above. Create the Checkout Session from a request the browser makes, so your server receives the cookie.
- Connect Stripe. Create a restricted key with Read on Charges, Checkout Sessions, Customers, Events, Invoices, Subscriptions and PaymentIntents, and paste it under payments. Secret keys are refused. The last 90 days are imported, then new payments every minute.
- Test it. Open your site in a private window from
https://yourapp.com/?utm_source=test&utm_medium=test, buy, wait for the next sync and open the payments list. The payment should show thetestsource instead of Unattributed.
If you also sell in the app through the stores, connect RevenueCat and set virling_vid on its customer before the purchase; RevenueCat web paywall attribution shows how. Every setting for the web side is on the Stripe integration page, and Virling for mobile apps covers RevenueCat apps.
A worked example
These numbers are made up, to show how to read the report. They are not from a real app and not a benchmark.
| Channel | Visitors | Web revenue | Revenue per visitor |
|---|---|---|---|
| Paid | 2,000 | $400 | $0.20 |
| 500 | $500 | $1.00 | |
| Unattributed | - | $300 | - |
Paid sent four times the visitors and less revenue. To weigh a web sale against a store sale, put your price in the App Store fee calculator.
What stays Unattributed
- In-app purchases that never touch the web. Someone who finds the app in the store and buys there has no visit to credit. With RevenueCat connected, the purchase counts toward revenue as Unattributed. With only Stripe connected, Virling does not see it at all.
- Links opened outside your site. A Payment Link opened from the app, an email, a QR code or another site carries no visitor ID. Send people to a page on your site that runs the script.
- Another browser or device. The visitor ID lives in one browser. Someone who sees your page on a laptop and pays on a phone is credited to the phone's visits. When checkout cannot carry the ID, Stripe payments can be matched by email.
- Older subscriptions and trials. Payments older than the 90-day backfill are not imported, so renewals of subscriptions that started before that are Unattributed. Trials that started before you connected are not seen.
What to know
- Virling does not track installs, only web visits and payments.
- The first charge after a free trial already has billing reason
subscription_cycle, so it is marked as a renewal. It is still credited to the visits before the trial, but Retention leaves out customers whose earliest payment is a renewal. - Customers are matched per provider. Someone who pays on Stripe and later buys in the app through RevenueCat counts as two customers.
- Connecting Stripe and RevenueCat on one site counts a sale twice if RevenueCat also reports your Stripe purchases. Connect one of them for those sales.
Open source
Virling is open source under AGPLv3, and the code is on GitHub. Use the hosted service, or self-host it as one binary with every feature.
Frequently asked questions
How does web to app revenue attribution work with Stripe?
A visitor lands on your site and buys through Stripe Checkout or a Payment Link before they install the app. The Virling script stores a visitor ID in the virling_vid cookie, and that ID travels to Stripe on the checkout. Virling reads the payment with a read-only restricted key and credits it to the visits before it.
Where do I put the visitor ID in Stripe?
On a Checkout Session you create, set client_reference_id to the virling_vid cookie, or metadata.virling_vid if you already use client_reference_id. With your own PaymentIntent, use metadata.virling_vid. Payment Links on buy.stripe.com need no code when they are normal links on a page that runs the script.
How are free trials and renewals credited?
A trial start, a Checkout Session with a total of 0, is kept apart from payments and never counted as revenue. The customer's later payment is credited to the visits before the trial started, as long as Stripe was connected by then. Renewals take the channel of the customer's first payment, matched by Stripe customer ID.
Can Virling track app installs or in-app purchases?
It does not track installs. Virling reads Stripe, and with RevenueCat connected, RevenueCat purchases too. A store purchase is credited to a visit only when the customer's virling_vid attribute was set from a web visit before it. Purchases that never touch the web count toward revenue as Unattributed.
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.
Full guides: Set up a mobile app, Stripe in the docs and Renewals.