Guides
Analytics
Track revenue, subscriptions, customers, and payment performance with built-in analytics.
PimaBill provides built-in analytics endpoints to track revenue, subscriptions, customers, and payment performance.
In the dashboard
Overview is the first page you see:
- Get set up: the steps left before you can bill, such as taking payments (your own provider, or managed payments on the cloud), a plan, a customer, an API key and a webhook address. It disappears once every step is done.
- Your numbers: monthly recurring revenue, active subscriptions, customers and payment success rate.
- Payments: the status of managed payments and your own providers.
- Plan usage: on the cloud, how much of your plan you are using.
Analytics has four tabs: Revenue, Subscriptions, Customers and Payments. Amounts there are in US dollars, converted from each currency you bill in. Export CSV downloads the last six months of revenue.
The endpoints below return the same figures for your own reports.
Revenue Analytics
curl "http://localhost:4000/api/analytics/revenue?dateFrom=2025-01-01&dateTo=2025-01-31¤cy=UGX" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
import { PimaBillClient } from 'pimabill';
const client = new PimaBillClient({ token: 'sk_live_a1b2c3d4...' });
const revenue = await client.analytics.getRevenue({
dateFrom: '2025-01-01',
dateTo: '2025-01-31',
currency: 'UGX',
});
console.log(revenue.totalRevenue); // Paid in the period
console.log(revenue.invoiceCount); // Invoices paid
console.log(revenue.mrr, revenue.arr); // Recurring revenue, monthly and yearly
from pimabill import PimaBillClient
client = PimaBillClient(token="sk_live_a1b2c3d4...")
revenue = client.analytics.get_revenue(date_from="2025-01-01", date_to="2025-01-31", currency="UGX")
print(revenue.total_revenue)
print(revenue.invoice_count)
print(revenue.mrr, revenue.arr)
Subscription Metrics
curl "http://localhost:4000/api/analytics/subscriptions" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const metrics = await client.analytics.getSubscriptions();
console.log(metrics.total); // All subscriptions
console.log(metrics.active, metrics.trialing, metrics.paused);
console.log(metrics.canceled); // Canceled in the period
console.log(metrics.churnRate, metrics.retentionRate); // Percentages
metrics = client.analytics.get_subscriptions()
print(metrics.total)
print(metrics.active, metrics.trialing, metrics.paused)
print(metrics.churn_rate, metrics.retention_rate)
Customer Metrics
curl "http://localhost:4000/api/analytics/customers" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const customers = await client.analytics.getCustomers();
console.log(customers.totalCustomers);
console.log(customers.newCustomers); // New in the period
console.log(customers.arpu); // Average revenue per customer
customers = client.analytics.get_customers()
print(customers.total_customers)
print(customers.new_customers)
print(customers.arpu)
Payment Analytics
curl "http://localhost:4000/api/analytics/payments?provider=STRIPE" \
-H "Authorization: Bearer sk_live_a1b2c3d4..."
const payments = await client.analytics.getPayments({
provider: 'STRIPE'
});
console.log(payments.successRate); // Percentage
console.log(payments.totalPayments, payments.succeeded, payments.failed, payments.pending);
payments = client.analytics.get_payments(provider="STRIPE")
print(payments.success_rate)
print(payments.total_payments, payments.succeeded, payments.failed)