Tracelayer Docs

kanmi-perf-revenue

v1.4.0 · MIT License (Free)

Revenue intelligence for web performance. Measures actual conversion rates at each performance bucket from your session data. No assumed coefficients — just empirical data.

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 It Produces

Empirical Conversion Curves

Actual CVR measured at each performance bucket:

LCP RangeSessionsCVRRevenue
0.0s-1.0s1,8523.67%$8K
1.0s-1.5s12,3392.79%$40K
2.0s-2.5s13,6842.22%$37K
3.0s+4201.40%$500

Revenue Opportunity

Prioritized by potential monthly revenue gain:

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 fields: 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

Features

FeatureDescription
8 Performance MetricsLCP, FCP, INP, CLS, TTFB, TTI, Onload, Page Size
SegmentationDevice, page type, geography, traffic source
Statistical SignificanceConfidence intervals, p-values, effect sizes
ROI CalculatorEngineering effort vs expected revenue gain
Forecasting12-month revenue projections
A/B Test IntegrationCompare performance variants statistically
Export FormatsJSON, CSV, Slack blocks, HTML email

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

Requirements

Repository

github.com/konfirmed/optimized-kanmi