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

Cookie consent revenue tracking: what a banner hides

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

Cookie consent limits revenue tracking to the buyers who accept. When a visitor declines or ignores the banner, the payment still reaches your payment provider, but no visitor ID goes into checkout, so the money has no channel. Your revenue total stays right; your revenue by channel covers only part of it. To find out how big that part is, log the consent choice and the visitor ID at each checkout. To get every payment you may link, call virling("consent") from your consent tool when the visitor accepts.

This page is about how the tracking works. It is not legal advice: whether you need consent, and for what, depends on where your visitors live and how you use the data.

What a banner does to attribution

Revenue by channel needs one ID on both sides: on the visit, and on the payment. The cookie is what carries it from the first page to checkout. The table shows what is left for each answer, with Virling set to Until consent.

What the visitor doesThe visitThe payment
Accepts on the first pageCounted, and continues under the same ID with its referrer and campaignCredited to a visit, when checkout carries the ID
Accepts on a later dayEvery visit is counted. The ones on earlier days were under other IDsCredited to a visit from the day they accepted or after it
Ignores the bannerCounted with a hash that changes every day. Nothing is storedCounts toward revenue, as Unattributed
DeclinesThe same as ignoring itCounts toward revenue, as Unattributed
Sends Global Privacy Control, on a tag with data-respect-gpcNot countedCounts toward revenue, as Unattributed

Ignoring the banner is easy to forget, because a consent report may show only yes and no. For attribution, no answer is a no.

The loss is not spread evenly. If people from one channel accept less often, that channel keeps its visitors and loses more of its revenue, so its revenue per visitor looks worse than it is. Whether to use the cookie from the first page, after consent or never is a separate choice, and cookieless analytics and revenue compares the three modes.

Measure your own share

A published consent rate says little about your site: the banner, the country and the audience all change it. There are two shares to measure, and the second is the one that matters for revenue.

Share of banners

Your consent tool may report this already. If it does not, send three goals, only when a visitor is asked for the first time and not each time a saved answer is read:

virling("goal", "banner shown");    // the banner opened for a first answer
virling("goal", "banner accepted"); // the first answer was yes
virling("goal", "banner declined"); // the first answer was no

Banners shown, minus accepted and declined, is the number left unanswered. It counts banners, not people, since someone who ignores it may see it again. On the Visitors page you can filter by goal and by source, which shows whether one source accepts less often. With Global Privacy Control respected, those browsers send no goals.

Share of buyers

Buyers may answer differently from visitors, so count them where they pay. If your server creates the checkout, log one line each time:

// Node, with cookie-parser
// savedChoice reads your consent tool's record: "yes", "no" or "none"
console.log("checkout", savedChoice(req), req.cookies.virling_vid ? "with ID" : "no ID");

After a finished month, count the lines. Example only, with made-up numbers for an imaginary store:

Saved choice at checkoutWith IDNo ID
Yes937
No025
No answer035
  • The banner. 60 of 160 checkouts had no consent, so 37.5% cannot be linked to a visit by ID.
  • A gap that is not the banner. 7 buyers accepted and still had no ID. Look for a script blocked by an ad blocker, a callback that did not run or a cookie your server does not receive.
  • A mistake. An ID next to No or No answer should be zero. If it is not, the tag may be missing data-cookieless, or a cookie from before the banner is still there.

These are checkouts started, not payments. If order sizes differ, log the amount too. The Virling dashboard also says what share of revenue is matched to a visit and how much had no visitor ID, but that count includes every cause, such as links opened from an email; the Unattributed docs list them.

Set up the consent callback

  1. In the site's settings, set Visitor cookie to Until consent. In plain Cookieless mode the call does nothing.
  2. Put the tag on every page, with data-cookieless. Without that attribute the script sets its cookie on the first page, before any answer. Leave out data-respect-gpc if you do not want the signal read.
<script>
  window.virling = window.virling || function () {
    (window.virling.q = window.virling.q || []).push(arguments);
  };
</script>
<script defer src="https://stats.example.com/v.js"
  data-site="yourdomain.com" data-cookieless data-respect-gpc></script>

The small script first is the stub that queues calls. It keeps your code from failing when the consent tool is faster than the script, or when the script is blocked or does not run because of Global Privacy Control.

  1. Call virling("consent") from your consent tool when the answer is yes, and delete the cookie when it is no. This is for a generic tool, so swap in the names yours uses:
// consentTool, onChoice and analytics stand for your tool's own names
consentTool.onChoice((choice) => {
  if (choice.analytics && !navigator.globalPrivacyControl) virling("consent");
  else forgetVisitor();
});

function forgetVisitor() {
  const gone = "virling_vid=;path=/;max-age=0";
  document.cookie = gone;
  const parts = location.hostname.split(".");
  for (let i = 0; i < parts.length - 1; i++) {
    document.cookie = gone + ";domain=" + parts.slice(i).join(".");
  }
}
  • If your tool runs the callback on every page with the saved answer, that is fine. virling("consent") does nothing once the cookie is there.
  • Pick the consent category that matches what your banner says. The cookie recognises a returning visitor and links a payment to the visits before it.
  • If you serve the script through your own proxy with data-api, forward GET requests to that path too.
  • The cookie only helps when checkout carries the ID. Your server can read virling_vid as soon as the cookie is set. In the browser, window.virling?.vid?.() and the ID added to payment links start with the next page load, which in a single-page app means a full reload.

To test it, open your site in a private window and check that there is no virling_vid cookie. Accept, and it should appear. Withdraw, and it should be gone.

Pages before consent

With Until consent, the pages a visitor sees before answering are counted under a hash made from the site, the IP address, the user agent and a salt kept only in memory. The IP address is not stored. When they accept, that hash ID becomes the cookie, so the landing page, referrer and campaign of that visit stay with them. The hash changes at midnight UTC and when the server restarts, so a visit that crosses either one starts over.

Some rules cover more than cookies. If you decide that nothing may be sent before consent, leave the tag off the page and add it from the callback, without data-cookieless and with the site set to Cookie. Visits without consent are then not counted. When someone accepts on their second page, the landing page is not recorded, and the visit can look Direct because the referrer is your own site and the tags were on the first address. If your banner already drives Google Tag Manager, the Tag Manager setup for Virling covers firing the tag only after the visitor accepts.

When consent is withdrawn

  • Delete the cookie. Virling does not watch your consent tool. The cookie is set on your main domain, which is why forgetVisitor tries each parent of the current host.
  • Reload the page. An open page can keep the ID in memory until it loads again. A visitor who accepts again without a reload may not get the cookie until the next page.
  • Run it for a plain no as well. The script reads a virling_vid cookie that is already there, so one set before you added the banner keeps working until it is deleted.
  • Know what stays. Deleting the cookie does not remove recorded visits and payments, and an ID already saved on a cart or a checkout stays there. Privacy and consent covers what can be deleted.

Global Privacy Control

Global Privacy Control is a signal the browser sends on every site, before any banner. With data-respect-gpc on the tag, the Virling script sends nothing for that browser, sets no cookie and adds no ID to checkout links. It does not delete a cookie from before, and your server would still read that one at checkout, so the callback above treats the signal as a no and deletes it. This only happens if your tool runs the callback for those visitors.

A visitor can send the signal and still press accept. The code above lets the signal win. Whether it should is a question for whoever advises you on privacy.

What to do with revenue you cannot link

  1. Keep the total from your payment provider as the revenue number, and show Unattributed as its own line. Do not spread it over the channels, because people who decline may come from different places than people who accept.
  2. Compare channels on attributed revenue, and compare their accept rates before you cut one.
  3. Ask buyers how they heard of you. Self-reported attribution needs no tracking cookie and reaches the buyers a banner hides.
  4. Do not use matching by email as a way around a no. Send the email only where your own policy and the visitor's answer allow it.

On a WooCommerce store, the built-in order attribution can follow the banner too, and a decline then shows as Unknown; see why WooCommerce order attribution says Unknown. For how Virling links store orders to visits, see revenue attribution for ecommerce.

Start free trial See the demo

Frequently asked questions

Can I track revenue without cookie consent?

The total, yes, because payments are imported from your payment provider. Revenue by channel, only in part: a payment is linked to a visit when checkout carries a visitor ID, and with Virling set to Until consent a visitor who has not accepted has none. Those payments show as Unattributed.

What happens to a payment when the visitor ignores the cookie banner?

The same as when they decline. The visit is counted with a daily hash, no cookie is set, and the payment counts toward revenue as Unattributed. If they accept later in the same visit, that visit continues under the same ID and a payment made after it can be credited to it.

How do I find my own consent rate for buyers?

Log one line per checkout with the saved consent choice and whether the visitor ID cookie is there. After a month, the checkouts with a decline or no answer, divided by all checkouts, is the share of buyers the banner leaves without a channel.

What should happen when a visitor withdraws consent?

Your consent tool's callback should delete the virling_vid cookie, and the page should reload so the script drops the ID it has in memory. Visits and payments already recorded stay. From then on the visitor is counted with the daily hash.

Does Global Privacy Control count as declining the banner?

That is a legal question for the places you sell to. In Virling, data-respect-gpc on the script tag makes the script send nothing for a browser with the signal on, whatever the banner says. Without the attribute the signal is not read.

Can I use the same consent callback with any consent tool?

Yes, if the tool can run your code when a visitor accepts and when they change their mind. Virling has no banner of its own and does not read a consent tool's signals, so it only knows what your callback tells it.

Link every payment you have consent for

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