Guides
Analytics
Track revenue, subscriptions, customers, and payment performance with built-in analytics.
Analytics
NovaBilling provides built-in analytics endpoints to track revenue, subscriptions, customers, and payment performance.
Revenue Analytics
curl "http://localhost:3000/api/analytics/revenue?dateFrom=2025-01-01&dateTo=2025-01-31¤cy=UGX" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
import { NovaBillingClient } from 'novabilling';
const client = new NovaBillingClient({ token: 'sk_live_a1b2c3d4...' });
const revenue = await client.analytics.getRevenue({
startDate: '2025-01-01',
endDate: '2025-01-31',
currency: 'UGX'
});
console.log(revenue.total); // Total revenue
console.log(revenue.count); // Number of payments
console.log(revenue.breakdown); // Daily breakdown
from novabilling import NovaBilling
client = NovaBilling(token="sk_live_a1b2c3d4...")
revenue = client.analytics.get_revenue(
start_date="2025-01-01",
end_date="2025-01-31",
currency="UGX"
)
print(revenue.total)
print(revenue.count)
Subscription Metrics
curl "http://localhost:3000/api/analytics/subscriptions" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const metrics = await client.analytics.getSubscriptions();
console.log(metrics.total); // Total subscriptions
console.log(metrics.active); // Currently active
console.log(metrics.churned); // Canceled this period
console.log(metrics.churnRate); // Churn percentage
metrics = client.analytics.get_subscriptions()
print(metrics.total)
print(metrics.active)
print(metrics.churn_rate)
Customer Metrics
curl "http://localhost:3000/api/analytics/customers" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const customers = await client.analytics.getCustomers();
console.log(customers.total); // Total customers
console.log(customers.newThisMonth); // New this month
console.log(customers.byCountry); // Breakdown by country
customers = client.analytics.get_customers()
print(customers.total)
print(customers.new_this_month)
print(customers.by_country)
Payment Analytics
curl "http://localhost:3000/api/analytics/payments?provider=STRIPE" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const payments = await client.analytics.getPayments({
provider: 'STRIPE'
});
console.log(payments.successRate); // Success rate percentage
console.log(payments.totalProcessed); // Total amount processed
console.log(payments.failureReasons); // Common failure reasons
payments = client.analytics.get_payments(provider="STRIPE")
print(payments.success_rate)
print(payments.total_processed)