RevenueCat web paywall attribution: which channel brought each subscriber
By Devendra Variya, co-founder of Virling. Published 2026-11-18, updated 2026-11-25.
RevenueCat web paywall attribution answers one question: which marketing channel brought this subscriber? A web paywall sells the subscription on a web page, so the buyer is a visitor first. Store that visitor's ID on the RevenueCat customer before they pay, and each purchase can be credited to the ad, post or search that sent them.
This post covers how web paywalls differ from in-app purchases, how to set the ID, and which purchases stay Unattributed no matter what you do. For the full setup, including renewals and refunds, see how to track RevenueCat revenue by traffic source.
Web paywalls versus in-app purchases
RevenueCat records who paid and for what. Whether you can also say where they came from depends on where the sale happened:
- Web paywall. The buyer lands on your site from an ad, a post or a search, and pays on a web page. There is a browser, a visit and a first source to read. If the page runs your analytics script, the link between visit and purchase is within reach.
- In-app purchase. The buyer pays inside the app through the App Store or Google Play. The store does not tell you which web page, if any, came before. A link exists only if the same person visited your site earlier and you stored their visitor ID on their customer at that time.
So a web paywall is the easy case, and an in-app purchase is the hard one. Both rely on the same thing: a visitor ID on the customer before the purchase. If the web sale goes through your own Stripe checkout instead, see web to app revenue attribution with Stripe.
Virling's Recent customers card lists the last 10 paying customers, and for a matched web paywall subscriber it shows the first source, the visits before paying and how long they took.
Set virling_vid before the purchase
Virling reads the customer attribute virling_vid. On a page that runs the script, window.virling.vid() returns the visitor ID, and the virling_vid cookie holds it for your server. The script does not write to RevenueCat itself, so you set the attribute in one of two ways:
- From the client with the RevenueCat SDK's
setAttributes, passing the visitor ID before the purchase starts - From your server with the RevenueCat REST API, using the cookie from the request and the customer's app user ID
The server call looks like this:
await fetch(`https://api.revenuecat.com/v2/projects/${projectId}/customers/${appUserId}/attributes`, {
method: "POST",
headers: { authorization: `Bearer ${process.env.REVENUECAT_SECRET_KEY}`, "content-type": "application/json" },
body: JSON.stringify({ attributes: [{ name: "virling_vid", value: req.cookies.virling_vid }] }),
});That call needs a key with write access to Customer information. Keep it on your server, separate from the key you give Virling.
The order matters. The purchase event carries the attributes the customer had when they paid, so set the ID when the account is created or when the paywall loads, not after checkout. If your paywall is hosted on a page you do not control, the script cannot run there: set the attribute from your own site before you send the buyer to it.
A web paywall funnel, step by step
Here is one subscriber's path on yourapp.com, with a web paywall on pay.yourapp.com that runs the script, and what Virling records at each step. The names are examples.
- Ad or post. You share a tagged link in a newsletter:
https://yourapp.com/?utm_source=newsletter&utm_medium=email&utm_campaign=launch. A plain tagged link records nothing until the page it points to loads. - Landing page. The script records the pageview and sets the
virling_vidcookie. The visit keeps its referrer, UTM tags, landing page, country and device, and its channel is Email because ofutm_medium=email. - Web paywall. The cookie is set on the registrable domain, so
pay.yourapp.comsees the same visitor ID and the paywall view belongs to the same visitor. Your server reads the cookie and setsvirling_vidon the RevenueCat customer. The payment itself comes from RevenueCat, in the next step. - Purchase. RevenueCat sends the purchase to the webhook Virling added. Virling records the amount in the currency the customer paid, reads
virling_vid, and credits the payment to one of that visitor's visits inside the lookback window, picked by your attribution model. If the customer starts a free trial instead, the trial start is kept apart from payments and never counted as revenue. - Renewal. Each renewal arrives by the same webhook and keeps the channel of the customer's first payment. After a free trial, the first paid renewal is credited through its own
virling_vidwhen the event carries one, and otherwise to the visit before the trial. A refund event marks the whole payment refunded.
The step to check first is the third. Everything before it works with the script alone, and everything after it depends on the attribute being on the customer before they pay. To test it, visit a page that runs the script from a tagged link in a private window, set that visitor's ID on a new test customer, and make a sandbox purchase. The payment should show your tag's source in Payments. Virling does not tell sandbox events from production ones, so the test stays in your reports. Use a new customer for each test: a later purchase by the same customer keeps the first payment's channel.
What stays Unattributed
A RevenueCat purchase is credited to a visit only when it carries a visitor ID. Everything else still counts toward revenue, as Unattributed:
- In-app purchases from people who never came through your site, such as those who found the app by searching the store
- Buyers who visited your site but made a new account in the app, so their app user ID was never linked to the visit
- Purchases made before the attribute was set
- Web paywall purchases from a page that did not run the script, and where nothing else set the attribute
There is no way around the first group: the visit did not happen, so there is nothing to credit. If most of your subscribers start in the store, the Unattributed share will be large. That is a useful number in itself: it tells you how much of your growth the web funnel explains.
The same rules by event:
| Event | Attributed | Not attributed |
|---|---|---|
| Web purchase | When the customer had virling_vid before paying, and that visitor has a visit inside the lookback window | When the attribute was missing or set after the purchase. It counts toward revenue as Unattributed |
| In-app purchase | When the app user's virling_vid was set from a web visit before the purchase | When the buyer never came through your site, or the attribute was not set. It counts toward revenue as Unattributed |
| Store install | Never. Virling reads payments from RevenueCat, not installs from the App Store or Google Play | Always. An install is not recorded at all, and a later purchase follows the in-app rule above |
| Renewal | To the channel of the customer's first payment, when that payment was attributed | When the first payment is Unattributed or is not in Virling, unless the renewal carries its own virling_vid. Subscription payments from before you connected are not imported |
Every row needs the webhook, and the webhook needs Virling to be reachable over https. Without it, only the one-time purchases from the first import arrive. The steps for an app are in Set up a mobile app.
Doing it with Virling
Virling connects with a RevenueCat V2 secret key and adds its own webhook for initial purchases, renewals, non-renewing purchases and cancellations. Each event carries the customer's attributes, so the visitor ID arrives with the purchase. A renewal keeps the channel of the first payment, and when a free trial converts, the first paid renewal is credited to the visit that started the trial. The setup is in the RevenueCat docs and on the RevenueCat integration page.
Frequently asked questions
What is RevenueCat web paywall attribution?
Crediting each subscription sold through a web paywall to the visit that led to it. You store the web visitor ID on the RevenueCat customer as the virling_vid attribute before the purchase, and the purchase arrives with it.
Does the Virling script set the RevenueCat attribute by itself?
No. The script sets the visitor ID and exposes it as window.virling.vid() and the virling_vid cookie. You write it to the customer with the SDK's setAttributes or the REST call from your server.
Can in-app purchases be attributed too?
Yes, when the app user's virling_vid attribute was set from a web visit before they bought. In-app purchases from people who never came through your site stay Unattributed.
Why do some web paywall purchases show as Unattributed?
The attribute was missing when the purchase happened: it was set after checkout, the paywall page did not run the script, or the buyer used an account that was never linked to a visit.
Which channel do renewals get?
A renewal keeps the channel of the first payment. When a free trial converts, the first paid renewal is credited to the visit that started the trial.
See which channel brings your subscribers
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.