Web analytics fundamentals
Report revenue from your site or let Stripe confirm it
By Jonas Reed · Oct 24, 2026 · 9 min read
You have two ways to get revenue onto a Peeko dashboard, and they answer different questions. The one line call answers "what did my site say it sold." The Stripe webhook answers "what did Stripe say it charged." For a first sale or a weekend project, the first is enough. For a number you will show a cofounder, compare against your bank, or use to decide where to spend, the second is the one to trust.
This post shows both in full, says what each can get wrong, and gives a rule for when to switch.
Option 1: one line from your own site
On your order confirmation page, after the purchase is real, call this:
<script>
window.peeko?.revenue?.({ amount: 49.99, currency: "USD", id: "order_1234" });
</script>
amount is in dollars, not cents. currency is a three-letter code. id is an optional order reference that keeps a page refresh from counting the same order twice. The optional chaining means the line does nothing, and throws nothing, if the Peeko script is missing or blocked (Peeko revenue docs).
That is the whole setup. Peeko is already one script tag with a site key, it sets no cookie, and it needs no configuration once it is on the page, so there is no second thing to install. If you have not put the tag on a page yet, install analytics and prove it works in one agent session covers it.
Two limits apply to self-reported sales, as of Oct 2026: a single sale cannot exceed 100,000 in its currency, and a site can report 500 sales a day. Sales over either limit are skipped, and your site settings show that it happened (Peeko revenue docs).
What the self-reported number gets wrong
The call runs in a visitor's browser. That has three consequences.
It misses sales when the script is blocked. Any browser-side measurement loses the visitors whose blockers stop it. How many depends heavily on audience. Plausible published one case: on a post that trended on Hacker News and Reddit over three days in late August 2021, Plausible counted 50,947 visitors and Google Analytics counted 21,054. Plausible attributed the gap to blockers and wrote that "58% of Hacker News readers, Reddit users and other techies block Google Analytics." The gap varied by browser:
Source: Plausible, 58% of Hacker News, Reddit and tech-savvy audiences block Google Analytics, Aug 31, 2021. Retrieved Oct 21, 2026.
Read that chart with its limits in mind. It is one site over three days, the audience was technical, the study used Universal Analytics, and Plausible is a competing analytics vendor that ran the comparison with a first-party proxy on its own side. The two tools also count unique visitors differently (Plausible). For ordinary traffic, Plausible says to expect strict blockers to miss "typically between 5% and 25% depending on your audience" (Plausible docs), and that figure comes from the same vendor. Neither number is a measurement of your site. They are a reason to expect the gap to be nonzero, and larger the more technical your buyers are.
Your buyers matter more than the average here. People who pay for developer tools are the people most likely to run a blocker. And a blocked visitor is invisible whether they buy or not, which means the revenue you lose is not a random sample of your sales.
It can overcount. A thank-you page can be reloaded, bookmarked or opened by hand. The id field guards against the reload case. It does nothing about a payment that was started and later failed, or about someone who types the call into the browser console. Anyone can run a function that lives in the page. That is a reason to label the number, not a reason to avoid it.
It cannot tell you it worked. Peeko's ingest endpoint answers 204 to every well formed beacon, valid key or not, so a tracker can never leak whether a key is real. The side effect is that a 204 in your network tab proves the beacon was well formed. It does not prove a sale was recorded. Check the dashboard after a real test purchase instead.
The dashboard tells you which kind of number you are looking at: the revenue tile says "Reported by your site" for these sales (Peeko revenue docs).
Option 2: Stripe confirms it
With the webhook, nothing in the visitor's browser decides whether a sale counts. Stripe sends a signed event to Peeko, and Peeko records it only if the signature checks out. Peeko never holds a Stripe API key. The only credential it stores for revenue is the webhook signing secret, which proves an event came from your account and does nothing else.
Setup takes three steps, per the Peeko revenue docs:
- Copy the webhook endpoint shown in the Revenue card in your site settings.
- In Stripe, add that endpoint and subscribe it to
checkout.session.completedandcheckout.session.async_payment_succeeded. The second event matters for payment methods that settle later. Without it, those sales never arrive. - Paste the signing secret, which starts with
whsec_, back into the Revenue card.
Only paid sessions are recorded. Each event is checked against its signature and a five-minute timestamp tolerance, and a duplicate order is stored once. The signing secret is the only thing you hand over. Your Stripe secret key stays in your own server environment.
Attribution without a cookie
A verified sale on its own tells you the amount. To know which page and source produced it, you pass a page token into the Checkout session. Peeko mints a token per page view, good for 48 hours, and a verified sale that carries it shows its page and source. Sales without a token appear as Unattributed.
In the browser, read the token and send it to your server when the buyer clicks:
const token = window.peeko?.token?.();
const res = await fetch("/api/checkout", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ peekoToken: token ?? null }),
});
const { url } = await res.json();
window.location.href = url;
On your server, put it in the session metadata under the key peeko_t:
import express from "express";
import Stripe from "stripe";
const app = express();
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
app.post("/api/checkout", express.json(), async (req, res) => {
const session = await stripe.checkout.sessions.create({
mode: "payment",
line_items: [{ price: process.env.STRIPE_PRICE_ID, quantity: 1 }],
success_url: "https://example.com/thanks",
cancel_url: "https://example.com/pricing",
metadata: req.body.peekoToken ? { peeko_t: req.body.peekoToken } : {},
});
res.json({ url: session.url });
});
Replace the two URLs and set the two environment variables. The price comes from your server, not from the request, so a visitor cannot choose their own amount. This is the cookieless path described in following an AI referral to a signup without cookies, applied to a payment: the token carries the visit to the sale, and no cookie is involved.
A buyer whose browser blocked the Peeko script has no token to send, so that sale arrives as Unattributed. It still counts. Under the self-reported call it would not have arrived at all.
The two options side by side
| One line call | Stripe webhook | |
|---|---|---|
| Time to wire | One line on the confirmation page | Endpoint, two events, one secret, and a metadata field for attribution |
| Who confirms the sale | Your own page | Stripe, through a signed event |
| Blocked script | Sale is lost | Sale still arrives, as Unattributed |
| Delayed payment methods | Only if your page fires after settlement | Covered by checkout.session.async_payment_succeeded |
| Dashboard label | Reported by your site | Verified by Stripe |
| Credential Peeko stores | None | Webhook signing secret only |
| Works without Stripe | Yes | No |
Both are subject to the same reading rules on the dashboard. Currencies are listed, never converted, and the tile shows the top-earning currency. Revenue is not changed by filters, has no period-over-period comparison, and does not subtract refunds (Peeko revenue docs). If refunds are common for you, subtract them yourself before quoting the number.
For comparison, Plausible's revenue goals take an amount through a JavaScript call, a CSS class or its Events API, and convert amounts to the goal's base currency. Its documentation describes no Stripe verification (Plausible docs). Peeko makes the opposite choice on currencies and adds the verified path. We cover the rest of that difference in Peeko vs Plausible.
When the one line call is the better choice
Stay with the call if any of these is true:
- You do not take payments through Stripe Checkout. The webhook is Stripe only, and the call works with any processor, as long as your confirmation page knows the amount.
- You have not made a sale yet. A number you can see today beats a verified pipeline you have not finished, and you can add the webhook the week the first real order lands.
- You want a rough direction, such as which page leads to purchases, and a 5% to 25% undercount would not change what you do.
- You are building with an agent and want a result in one pass. The call is one line that an agent can add and a human can read in a second.
Move to the webhook if any of these is true:
- The revenue number goes into a decision, a report or an investor update.
- Your buyers are technical, so blockers are likely.
- You sell something with delayed payment methods.
- You have ever compared the dashboard with Stripe and found they disagreed.
What happens when you switch
Peeko keeps the two totals apart. Verified and self-reported amounts are never added together, so connecting Stripe cannot double count a sale that both paths saw. While a signing secret is stored, Peeko ignores the JavaScript call on that site. You do not need to remove the line from your confirmation page, and disconnecting Stripe turns the call back on (Peeko revenue docs).
For a date range that spans the day you connected Stripe, the tile shows the verified total and notes the self-reported amount beside it (Peeko revenue docs). Do not read a change across that day as growth or a drop. It is a change in who is counting.
To check the result from a terminal or an agent, the numbers are available over MCP. get_revenue returns amounts in minor units, so 499900 in USD means $4,999, and the CLI command prints the same data (Peeko revenue docs). Because npx @usepeeko/cli speaks the same MCP endpoint an agent does, a command and a tool call return the same numbers. Connecting Claude Code or Cursor to your analytics over MCP shows the setup, and it is a quick way to compare the dashboard tile against your Stripe dashboard after a test purchase.
A rule you can apply today
Add the one line this afternoon. Make one real purchase and confirm it shows up as "Reported by your site." Then set a date, such as your first ten sales, and connect the webhook by then. After that, compare the verified total with your Stripe dashboard once. If the two match, you can stop thinking about it. If they do not, the gap is the sales the browser never reported, and that is the number the one line call was hiding from you.