Before you connect
Create a Stripe restricted key that starts withrk_live_ or rk_test_. Grant only:
- Webhook Endpoints: Write
- Charges: Read
- Refunds: Read
Connect Stripe
Open the integration
Enter the restricted key
Save the connection
stripe.com to the site’s referrer exclusions, so a return from Stripe does not start a new acquisition session.
Set up the webhook manually
If the restricted key cannot create webhook endpoints, tinyanalytics shows a webhook URL and accepts a signing secret instead:Create the Stripe webhook
charge.succeeded, refund.created, refund.failed, and charge.dispute.closed.Copy the signing secret
whsec_.Finish the connection
How do I attribute Stripe revenue to a marketing channel?
Write the visitor’s identified user ID into Stripe metadata asta_identified_user_id when you create the payment. A Stripe charge arrives on your server with no knowledge of the browser that caused it, so this ID is the link tinyanalytics uses to credit the sale to the visitor’s entry channel, campaign, referrer, and country. Payments with no link are reported under (no session).
You can find the same snippet in the app under Settings → Integrations → Stripe → Attribution.
Identify signed-in visitors
identify() with your own user ID after login or signup. Pass the email trait too if you plan to use email fallback for guest checkouts:localStorage, so it survives reloads and is still available when the visitor reaches checkout.Read the ID on your checkout page
getUserId() returns the identified ID, or null for a visitor who has not been identified. Send it to your backend alongside whatever your checkout call already posts:Set the metadata where you create the payment
ta_identified_user_id to the Stripe call your backend already makes. Use the pattern that matches your integration:null rather than writing an empty string. An empty value is not a link, and it stops the email fallback from running.Turn on email fallback for guest checkouts (optional)
ta_* metadata at all. It matches an identified user whose ID is that email address, or who has a matching email trait from identify().The email is used only during matching and is never written to your analytics events.Which metadata keys does tinyanalytics read?
tinyanalytics looks for these keys on the charge, payment intent, and Checkout Session, in that order. The first one it finds wins, so setting the metadata in one place is enough.ta_session_id and ta_user_id are still honored when a payment carries them, but the tracking script never hands those values to your page. ta_identified_user_id is the key to use.What appears in the Revenue report?
The report separates revenue into three tabs:How does tinyanalytics decide which channel gets the credit?
Every Stripe payment resolves in this order, and the first match wins:- Linked to a session — the payment is credited to that session’s entry channel, campaign, referrer, and country.
- Linked to an identified user — the payment is credited to the entry of that person’s most recent session at or before the payment time. This is last-touch attribution within your reporting window: the visit that immediately preceded the sale gets the credit.
- No link — the payment is reported under
(no session).
(no session).
Tag one payment per customer, not every payment
Links are stored against the Stripe customer, so a customer only needs to be tagged once. Later payments from that customer inherit the link automatically — which means subscription renewals attribute without any repeated work. Tag the subscription at signup and every renewal invoice lands on the channel that won the original sale. Refunds and lost disputes inherit their original charge’s customer, so a negative adjustment subtracts from the same channel the sale was credited to.Links are applied when reports are read
Attribution is resolved at report time, not frozen at payment time. If you add the metadata to your checkout today, the customers you tag from now on attribute correctly — and their other payments follow the same link the next time the report loads. You do not need to reprocess anything in Stripe.Why does my Stripe revenue show as (no session)?
(no session) means the payment reached tinyanalytics with no link to a visitor, so there is no channel to credit it to. It is a real bucket, not an error. Work through these causes in order:
Where does Stripe revenue apply?
Stripe revenue appears in the Revenue report and inscoped_stripe_revenue queries. Goals, funnels, experiments, and revenue alerts currently use client revenue events only.
Frequently asked questions
Can I connect Stripe with a test-mode key?
Can I connect Stripe with a test-mode key?
rk_test_… and rk_live_… restricted keys are supported. The connection status shows whether the key is in test or live mode.Does connecting Stripe import my old payments?
Does connecting Stripe import my old payments?
What happens when I disconnect Stripe?
What happens when I disconnect Stripe?
Does net revenue subtract Stripe fees?
Does net revenue subtract Stripe fees?
Do I have to tag every Stripe payment with metadata?
Do I have to tag every Stripe payment with metadata?
Do I need metadata if I already turned on email fallback?
Do I need metadata if I already turned on email fallback?
ta_* metadata at all, and it can only match buyers you have already identified by email address or with an email trait. Use metadata for signed-in buyers and email fallback to catch guest checkouts.Why is Paying Sessions low or zero on the Stripe tab?
Why is Paying Sessions low or zero on the Stripe tab?
ta_identified_user_id credit revenue to a channel, campaign, and country, but they do not add to Paying Sessions. Use Orders as the Stripe purchase count.Can I test attribution before going live?
Can I test attribution before going live?
rk_test_… restricted key, identify yourself in the browser, and complete a test checkout with Stripe’s 4242 4242 4242 4242 card while your ta_identified_user_id metadata is set. The charge appears on the Stripe tab with your entry channel instead of (no session).Verify
(no session) — in the Revenue report’s source, campaign, and country breakdowns. If it lands in (no session), check the payment in Stripe: the charge, its payment intent, or its Checkout Session should carry a non-empty ta_identified_user_id in Metadata.