Stripe API
Step 1: Connect Stripe to Humblytics
Before Humblytics can track your revenue, connect your Stripe account:
Go to your Humblytics dashboard and open Site Settings
Click the Revenue tab
Select Stripe as your payment provider
Choose Stripe API as the integration method
Enter your Stripe Secret Key (available in your Stripe Dashboard)
Save your configuration
Your Stripe Secret Key is encrypted and stored securely. Never share it publicly.

Step 2: Add the humblytics_view_id
Metadata
humblytics_view_id
MetadataTag your Stripe objects with a humblytics_view_id
to link payments back to the visitor session. Humblytics looks for the first humblytics_view_id
across these Stripe objects:
PaymentIntent
One-time payments or custom payment flows
Invoice
Payments generated from invoices
Subscription
Recurring payments and renewals
Checkout
Hosted checkout flows using Stripe Checkout
Customer
Apply the ID globally to future invoices/payments
💡 If you store the ID on a Subscription
or Customer
, Humblytics automatically applies it to future invoices and payments for that customer.
Frontend: capture the view ID
// Get the current Humblytics view ID on the client
const viewId = window.Humblytics.viewId;
// Send it to your backend along with the payload you already collect
await fetch("/api/create-payment", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
amount: 5000,
currency: "usd",
humblytics_view_id: viewId,
// ...any other fields you need to pass along
}),
});
Backend examples
Attach the humblytics_view_id
inside your server-side Stripe calls. Pick the object that matches your flow.
// One-time payment using PaymentIntents
const { amount, currency, humblytics_view_id } = payload;
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
metadata: {
humblytics_view_id,
},
});
// Subscription signup
const { customerId, priceId, humblytics_view_id } = payload;
const subscription = await stripe.subscriptions.create({
customer: customerId,
items: [{ price: priceId }],
metadata: {
humblytics_view_id,
},
});
// Stripe Checkout Session
const { line_items, humblytics_view_id } = payload;
const session = await stripe.checkout.sessions.create({
line_items,
mode: "payment",
metadata: {
humblytics_view_id,
},
});
// Apply globally to a Customer record
const { customerId, humblytics_view_id } = payload;
await stripe.customers.update(customerId, {
metadata: {
humblytics_view_id,
},
});
Step 3: View Attributed Revenue
After a payment succeeds, Humblytics automatically attributes the revenue to the correct visitor session—no webhooks or extra setup required. Review the revenue metrics (referrer, country, browser, etc.) in your Humblytics dashboard.

Key Benefits
Automatic attribution
Revenue linked to visitor and campaign data
Flexible integration
Works with Checkout, PaymentIntents, Subscriptions, etc.
No webhooks needed
Metadata-based tracking keeps setup simple
Privacy-compliant
Cookie-free tracking, no consent banners
Split test ready
Use revenue as a goal in your Humblytics A/B tests
Setting Up Split Tests with Revenue Goals
Create a split test on your main website
Choose Revenue as your goal type
Set a target revenue or select Any Revenue
Launch the test - revenue is tracked automatically

Troubleshooting
No revenue data appearing? Confirm your Stripe account is connected to Humblytics.
Missing attribution? Ensure a
humblytics_view_id
metadata field is set on at least one supported Stripe object.Need help? Reach us at [email protected].
Last updated
Was this helpful?