Revenue Attribution
Connect your revenue data to marketing campaigns and see exactly which channels drive your most valuable customers.
Setup Time
10 minutes
Difficulty
Medium
Value
Game-changing
Revenue attribution connects customer purchases back to their original marketing touchpoints, giving you a complete picture of which campaigns generate actual revenue, not just traffic.
Visitor arrives via marketing campaign
Multiple touchpoints tracked
Customer makes purchase
Revenue linked to original campaign
- • See which campaigns generate the highest value customers
- • Calculate true ROI for your marketing spend
- • Optimize budget allocation based on revenue data
- • Track customer lifetime value by acquisition channel
Integration Methods
Step 1: Set up Webhook Endpoint
Create a webhook endpoint to receive Stripe events and forward revenue data:
// Stripe webhook endpoint (Next.js API route example)
import { NextRequest, NextResponse } from 'next/server';
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET!;
export async function POST(request: NextRequest) {
const body = await request.text();
const signature = request.headers.get('stripe-signature')!;
let event: Stripe.Event;
try {
event = stripe.webhooks.constructEvent(body, signature, webhookSecret);
} catch (err) {
console.error('Webhook signature verification failed:', err);
return NextResponse.json({ error: 'Webhook error' }, { status: 400 });
}
// Handle successful payment
if (event.type === 'checkout.session.completed') {
const session = event.data.object as Stripe.Checkout.Session;
// Send revenue data to theBizness.ai
await fetch('https://thebizness.ai/api/revenue', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.THEBIZNESS_API_KEY}`
},
body: JSON.stringify({
website_id: process.env.THEBIZNESS_WEBSITE_ID,
customer_id: session.customer,
session_id: session.id,
amount: session.amount_total, // in cents
currency: session.currency,
timestamp: new Date().toISOString(),
metadata: session.metadata
})
});
}
return NextResponse.json({ received: true });
}
Step 2: Configure Stripe Webhook
- 1. Go to your Stripe Dashboard → Webhooks
- 2. Add endpoint:
https://yourdomain.com/api/webhooks/stripe
- 3. Select events:
checkout.session.completed
- 4. Copy the webhook signing secret to your environment variables
Step 3: Environment Variables
STRIPE_SECRET_KEY=sk_live_... STRIPE_WEBHOOK_SECRET=whsec_... THEBIZNESS_API_KEY=your_api_key THEBIZNESS_WEBSITE_ID=your_website_id
- • 100% reliable - no missed transactions
- • Works even if customer closes browser
- • Handles all payment types and currencies
- • Includes subscription and refund events
Required Fields
Optional Fields
Campaign ROI
See revenue and ROI for each marketing campaign
Customer LTV
Track lifetime value by acquisition channel
Revenue Funnel
See the path from visitor to paying customer
Cohort Analysis
Compare customer cohorts over time
Attribution Models
First-touch, last-touch, and multi-touch attribution
Real-time Revenue
Live revenue tracking and alerts
Example Insights You'll Get:
- • "Facebook ads generated $12,450 in revenue this month with 4.2x ROI"
- • "Email campaigns have the highest customer lifetime value at $230"
- • "Organic search visitors convert 40% better than paid search"
- • "Mobile traffic has lower conversion but higher average order value"
💰 Start Tracking Revenue Attribution
Ready to see which marketing channels drive your highest value customers? Set up revenue tracking and start optimizing for ROI.
🔗 Stripe Integration
Connect your Stripe account for automatic tracking
📊 Revenue Dashboard
See campaign ROI and customer lifetime value
🎯 Attribution Models
Multiple attribution models for accurate insights