Skip to content

konfirmed/optimized-kanmi

Repository files navigation

kanmi-perf-revenue

Revenue intelligence for web performance — Native Datadog RUM integration or bring your own data.

No assumed coefficients. No "0.5% CVR per 100ms" guesses. This tool measures the actual conversion rates at each performance bucket from YOUR session data.

Install

npm install kanmi-perf-revenue

Quick Start

CLI

# Demo with mock data
npx kanmi-perf-revenue --demo

# From CSV/JSON file
npx kanmi-perf-revenue --file sessions.csv --client "Acme Corp"

# From Datadog RUM
DD_API_KEY=xxx DD_APP_KEY=xxx npx kanmi-perf-revenue --start 2026-01-01 --end 2026-01-14

Library

import { analyzeFromFile, analyzeWithDatadog } from 'kanmi-perf-revenue';

// From CSV/JSON
const result = analyzeFromFile({
  filePath: './sessions.csv',
  clientName: 'Acme Corp',
});

// From Datadog RUM
const result = await analyzeWithDatadog({
  apiKey: process.env.DD_API_KEY,
  appKey: process.env.DD_APP_KEY,
  startDate: '2026-01-01',
  endDate: '2026-01-14',
});

console.log(result.report);
console.log(`Top opportunity: $${result.topOpportunity?.monthlyRevenue}/month`);

What You Get

Empirical Conversion Curves

Actual CVR measured at each performance bucket:

| LCP Range   | Sessions | CVR    | Revenue |
|-------------|----------|--------|---------|
| 0.0s-1.0s   | 1,852    | 3.67%  | $8K     |
| 1.0s-1.5s   | 12,339   | 2.79%  | $40K    |
| 2.0s-2.5s   | 13,684   | 2.22%  | $37K    |
| 3.0s+       | 420      | 1.40%  | $500    |

Revenue Opportunity

Top Opportunity: LCP
37% of sessions have LCP > 2.5s
These sessions convert 18.5% worse than faster sessions
Monthly revenue opportunity: $10K/month

Data Input

CSV/JSON Format

Required: session_id, converted (or has_purchase)

Optional: lcp_ms, inp_ms, cls, fcp_ms, ttfb_ms, order_value, device, page_type

session_id,lcp_ms,converted,order_value,device
abc123,1200,1,89.99,mobile
def456,3500,0,0,desktop

See docs/data-sources.md for Datadog setup and self-hosted options.

Features

Feature Description
8 Performance Metrics LCP, FCP, INP, CLS, TTFB, TTI, Onload, Page Size
Segmentation Device, page type, geography, traffic source
Statistical Significance Confidence intervals, p-values, effect sizes
ROI Calculator Engineering effort vs expected revenue gain
Forecasting 12-month revenue projections
A/B Test Integration Compare performance variants statistically
Export Formats JSON, CSV, Slack blocks, HTML email

See docs/advanced-usage.md for detailed examples.

CLI Reference

kanmi-perf-revenue [options]

Data Sources:
  --file PATH         Import from CSV or JSON file
  --demo              Run with mock data (for testing)
  --api-key KEY       Datadog API key (or set DD_API_KEY)
  --app-key KEY       Datadog App key (or set DD_APP_KEY)

Options:
  --start DATE        Start date (YYYY-MM-DD)
  --end DATE          End date (YYYY-MM-DD)
  --client NAME       Client name for report header
  --save              Save analysis to history
  --compare           Compare to baseline
  --help, -h          Show help

How It Works

  1. Bucket sessions by performance — Group by performance ranges (e.g., 0-1s, 1-2s LCP)
  2. Measure actual CVR per bucket — Calculate conversion rate from your real data
  3. Calculate opportunity — If slow sessions performed like fast ones, how many more conversions?
  4. Prioritize by revenue impact — Rank metrics by potential monthly revenue gain

No industry benchmarks. No assumed coefficients. Just your data.

License

MIT

Author

Kanmi Obasa i@kanmiobasa.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published