Revenue
Other Stripe payment methods
On this page
Every Stripe payment is imported once Stripe is connected. Attribution comes from a few metadata keys, wherever in Stripe you set them.
Where MetricRaven looks
For each successful live charge, MetricRaven reads these keys from, in increasing priority:
- the Customer's metadata,
- the PaymentIntent's metadata,
- the Checkout Session's metadata, only when the Customer and PaymentIntent carry neither a visitor ID nor a user ID,
- for invoice payments, the subscription's metadata (as copied to the invoice) and the invoice's,
- the Charge's own metadata.
| Metadata key | What it does |
|---|---|
| metricraven_visitor_id | The value of window.analytics.getVisitorId() in the buyer's browser. Links the payment to that visit and its traffic source. Anything that isn't a MetricRaven visitor ID is ignored. |
| metricraven_user_id | Your own user ID. If you call Identify with the same ID, the payment joins that user's visits even without a visitor ID. |
| metricraven_plan | Optional plan name shown with the payment. Subscription invoices fall back to the price ID. |
| metricraven_renewal | Optional "true" for a repeat payment. Ignored for subscription invoices, where Stripe's billing reason decides. |
Customer metadata: one place for every payment
If you create a Stripe Customer per user, set the keys there once. Invoices, the customer portal, upgrades and charges you make later all inherit it, however they're paid.
Server
// When you create the Stripe customer (for example at signup).
const customer = await stripe.customers.create({
email: authenticatedUser.email,
metadata: {
metricraven_user_id: authenticatedUser.id,
metricraven_visitor_id: visitorId || "",
},
});By payment method
| How you charge | Where to put the keys |
|---|---|
| Checkout Sessions | Session and PaymentIntent or subscription metadata; see Stripe Checkout. |
| Payment Element / PaymentIntents | PaymentIntent or subscription metadata; see Stripe PaymentIntents. |
| Payment Links, pricing tables, buy buttons | Needs a webhook; see Stripe Payment Links. |
| Subscriptions via the API | Subscription metadata, or the Customer's. |
| Invoices (Stripe Invoicing) | Invoice metadata, or the Customer's. |
| Dashboard charges and manual invoices | The Customer's metadata. Set it once in the Dashboard. |
| Platforms that charge through your Stripe account (Kajabi, Podia and similar) | Usually none you can set, so their payments import without a visit link. |
Server
// Invoices you send yourself.
const invoice = await stripe.invoices.create({
customer: customerId,
metadata: { metricraven_user_id: authenticatedUser.id, metricraven_plan: "consulting" },
});Not on Stripe?
Send payments from your backend with the Payments API, or connect RevenueCat for app stores. Don't also send Stripe payments through the Payments API, or they're counted twice.
Details
- Signed-in buyers can be linked by
metricraven_user_idalone when you call Identify with the same user ID. - Metadata is read when MetricRaven imports the charge, usually within a minute or two of the payment. Set it when you create the object; adding it after the import doesn't change that payment.
- Once one payment from a Stripe customer is linked, that customer's later payments (renewals, upgrades) are linked to the same visitor and user, and their earlier unlinked payments are filled in.
- MetricRaven does not read
client_reference_id, the customer's email, custom checkout fields or UTM parameters on Stripe links. Only the metadata keys above link a payment to a visit. - Only live-mode payments are imported. Test-mode payments never appear in MetricRaven.