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

How Revenue Attribution Works
Understanding the customer journey from first touch to revenue

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.

1. First Touch

Visitor arrives via marketing campaign

User clicks Facebook ad with UTM parameters
2. Engagement

Multiple touchpoints tracked

Views product pages, reads blog posts
3. Conversion

Customer makes purchase

Completes checkout with Stripe
4. Attribution

Revenue linked to original campaign

Facebook ad gets credit for $99 revenue
Key Benefits
  • • 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

Stripe Webhook Integration
Automatically track revenue from Stripe payments (most reliable method)

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. 1. Go to your Stripe Dashboard → Webhooks
  2. 2. Add endpoint: https://yourdomain.com/api/webhooks/stripe
  3. 3. Select events: checkout.session.completed
  4. 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
Why Webhooks?
  • • 100% reliable - no missed transactions
  • • Works even if customer closes browser
  • • Handles all payment types and currencies
  • • Includes subscription and refund events
Data Requirements
Required and optional fields for revenue tracking

Required Fields

website_id
Your theBizness.ai website ID
amount
Revenue amount in cents (e.g., 9999 for $99.99)
currency
ISO currency code (e.g., "USD", "EUR")
customer_id
Unique identifier for the customer

Optional Fields

order_id
Unique order identifier
plan_name
Subscription plan name
interval
Billing interval ("month", "year")
metadata
Additional custom data
Revenue Analytics & Reports
What you'll see in your theBizness.ai dashboard

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