Skip to content
all posts
Revenue 4 min read

How to connect Stripe revenue to your website analytics

A step-by-step guide to putting Stripe revenue on the same chart as your traffic — which key to create, which two permissions to grant, and what the numbers will and will not tell you afterwards.

By Sourav · Building sonex
All posts

Your traffic lives in one tab and your money lives in another. Every time you want to know whether last week worked, you compare two charts by memory. This guide closes that gap for Stripe: about five minutes of setup, no code, and no tracker changes.

Before you start

Two things worth deciding up front.

Use a restricted key, not your secret key. Stripe calls them RAKs and they start with rk_live_. A standard secret key (sk_live_) carries write access to your entire account — refunds, payouts, customers — and no analytics tool has any use for that. If a tool asks for one, that is the answer to your due-diligence question.

Connect per website. Revenue is a property of one site, not your whole account. If you run several products through one Stripe account, connect the key on the website whose traffic the revenue belongs to.

Step 1: create the restricted key

In the Stripe dashboard, go to Developers → API keys → Create restricted key. Name it something you will recognise in six months (sonex analytics — read only works).

Then grant exactly two permissions and leave every other resource on None:

Stripe resourcePermissionWhat it is for
ChargesReadThe revenue itself
BalanceReadConfirming the key works when you connect it

That is the whole grant. Charges read cannot move money, cannot issue a refund, and cannot read your customer records. If the key leaks, the worst outcome is that someone learns your revenue — bad, but not catastrophic, and revocable in one click from the same screen.

Step 2: paste it into your analytics

In sonex, open the website’s Settings, find the Revenue card, pick Stripe, and paste the key. The last step of onboarding offers the same thing; skipping it there costs nothing and you can do it any time.

The key is verified against your account balance before it is saved, so a key with the wrong permissions is rejected immediately rather than failing silently a week later. Credentials are encrypted before storage, and only the last four characters are ever shown back to you.

Step 3: read it

Once connected, revenue shows up in two places:

  • Overview gains revenue as a focusable series on the main chart, plotted on its own money axis beside views and visitors, plus a revenue tile for the selected range.
  • Reports gains a Revenue runner: pick a currency, press Run, get revenue over time for the range you selected.

Revenue is aggregated from succeeded charges, net of refunds. Failed and unpaid charges are ignored, so the line is money you actually received rather than money someone attempted to send.

What the numbers mean, exactly

Three things to internalise before you make decisions on this chart.

It is your provider’s data, not your analytics tool’s. Revenue is read from Stripe over its API. It is not derived from tracked events, and no tracked event is needed for it to work. If your tracker is blocked for a visitor, that visitor’s purchase still shows in revenue.

It is not per-visitor attribution. You are seeing revenue over time next to traffic over time. When both climb together the story is suggestive, not proven — a newsletter, a price change and a launch can all land in the same week. For credit assignment, fire a conversion event yourself and read the Attribution report.

One currency at a time. The Revenue runner takes a currency, so a business charging in several reads them one at a time rather than adding unlike things together. This is deliberate: a combined figure would need an exchange rate and a date convention, and any choice there would be wrong for someone.

Troubleshooting

The key was rejected. Almost always a missing Balance read permission — the verification call needs it. Edit the key’s permissions in Stripe rather than creating a new one.

Revenue is zero but Stripe shows charges. Check the date range in the dashboard, then check the currency in the Revenue runner. A shop charging in EUR shows nothing under USD.

Revenue stopped updating. Restricted keys can be revoked from the Stripe dashboard. If someone rotated keys, reconnect from the same Revenue card; nothing else about your analytics is affected while it is disconnected.

If you are on Polar instead

The shape is identical. Paste your organization ID and an organization access token created under Settings → Developers → New token, scoped to metrics:read and organizations:read and nothing else. Set an expiry you are willing to maintain — when the token expires revenue stops updating and the card asks you to reconnect.

Full details for both providers are in the Revenue docs. Revenue is included on every plan, including Free, so there is nothing to upgrade to before trying this.

Frequently asked questions

How do I connect Stripe to my website analytics?
Create a restricted API key in Stripe under Developers → API keys → Create restricted key, grant read access to Charges and Balance and nothing else, then paste it into the Revenue card in your website's settings in sonex. Revenue appears on the Overview chart once the key is verified.
Which Stripe permissions does an analytics tool need?
Two, both read-only. Charges read, which is the revenue itself, and Balance read, which is used to verify the key works when you connect it. Every other resource should be left on None. Never paste a standard secret key that starts with sk_live_, because it carries write access to your whole account.
Does connecting Stripe send my customer data to my analytics?
In sonex, no. It reads aggregate charge amounts and timestamps over the Stripe API. Your customer list is not pulled into analytics, and no visitor data travels back to Stripe.
Is Stripe revenue in analytics the same as per-customer attribution?
No. It is revenue over time plotted next to traffic over time. It shows you that a spike in traffic coincided with a spike in revenue; it does not prove which visitor produced which charge. For credit assignment you need a conversion event and an attribution report.

sonex is privacy-first web analytics. No cookies, no consent banner, no personal data. Drop one script and read realtime visitors, funnels and a world map in seconds.

Try sonex free
Questions

Frequently asked.

Cookies, install and pricing, answered. Still stuck? Ask us anything .

01 Can sonex show revenue next to my traffic?

Yes. Connect Stripe or Polar with a read-only key and sonex reads revenue straight from your payment provider, per website. Revenue then appears as a focusable series on the Overview chart and as its own report, beside the traffic that earned it. No tracked event is needed for it to work.

02 Does sonex use cookies?

No. sonex sets no cookies and needs no consent banner. It counts visits without cookies, fingerprinting, or any personal data, so it is GDPR, PECR and CCPA-ready by default.

03 How do I install sonex?

Add one script tag to your site's <head> with your website id. It is a single lightweight tracker — no build step and no SDK required.

04 Is sonex a Google Analytics alternative?

Yes. sonex gives you the reports that matter — visitors, pages, referrers, funnels, revenue and a world map — without surveilling your audience or drowning you in configuration.

05 How is sonex priced?

By monthly tracked events. Free covers 2k events, Pro is $20/mo for 200k events, and Business is $200/mo for 2M events with team seats.

See what your traffic actually earns.

Revenue beside the visitors that produced it. No cookies, no credit card, no consent banner.

Get started