← Back to all products
$49
E-Commerce Analytics Dashboard
Sales analytics, customer cohort analysis, conversion funnel tracking, revenue forecasting, and KPI dashboards.
MarkdownYAMLPythonSQLPostgreSQL
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 20 files
ecommerce-analytics-dashboard/
├── LICENSE
├── README.md
├── configs/
│ └── dashboard_config.yaml
├── data/
│ └── sample_transactions.csv
├── free-sample.zip
├── guide/
│ ├── 01-overview.md
│ ├── 02-sales-analytics-and-kpis.md
│ └── 03-cohort-analysis-and-funnel-tracking.md
├── guides/
│ └── analytics_guide.md
├── index.html
├── sql/
│ └── queries.sql
├── src/
│ ├── __init__.py
│ ├── chart_export.py
│ ├── cohort_analysis.py
│ ├── funnel_tracker.py
│ ├── kpi_calculator.py
│ ├── revenue_forecast.py
│ └── sales_analytics.py
└── tests/
└── test_analytics.py
📖 Documentation Preview README excerpt
E-Commerce Analytics Dashboard
A complete Python analytics toolkit for e-commerce businesses. Covers every metric that matters: sales aggregation, customer cohort analysis, conversion funnel tracking, revenue forecasting, and KPI computation — all from raw transaction data.
What You Get
- Sales Analytics Engine — daily/weekly/monthly revenue summaries, top products, category & channel breakdowns, period-over-period growth rates
- Customer Cohort Analysis — retention matrices, cohort revenue curves, cumulative LTV by acquisition month
- Conversion Funnel Tracker — multi-stage funnel modeling with drop-off rates, bottleneck detection, and per-segment breakdowns
- Revenue Forecasting — moving average, weighted MA, linear trend, and seasonal decomposition — all pure Python, no numpy required
- KPI Calculator — AOV, LTV, CAC, conversion rate, cart abandonment, repeat purchase rate, gross margin, and industry benchmark checks
- Chart & Export Helpers — matplotlib bar/line/funnel charts (guarded import) plus CSV and JSON export
- SQL Query Library — 10 drop-in PostgreSQL queries for the same analytics directly against your database
- Sample Data — 50-row transaction CSV ready to test everything immediately
Project Structure
ecommerce-analytics-dashboard/
├── README.md # This file
├── LICENSE # MIT License
├── .gitignore
├── src/
│ ├── __init__.py # Package imports
│ ├── sales_analytics.py # Sales aggregation & ranking
│ ├── cohort_analysis.py # Cohort retention & revenue
│ ├── funnel_tracker.py # Conversion funnel analysis
│ ├── revenue_forecast.py # Time-series forecasting
│ ├── kpi_calculator.py # Core e-commerce KPIs
│ └── chart_export.py # Charting & data export
├── sql/
│ └── queries.sql # PostgreSQL analytics queries
├── data/
│ └── sample_transactions.csv # 50-row example dataset
├── tests/
│ └── test_analytics.py # Comprehensive test suite
├── configs/
│ └── dashboard_config.yaml # Configuration reference
└── guides/
└── analytics_guide.md # Detailed usage guide
Quick Start
# Run sales analysis on the sample data
python -m src.sales_analytics data/sample_transactions.csv
# Run cohort analysis
python -m src.cohort_analysis data/sample_transactions.csv
# Run the conversion funnel demo
python -m src.funnel_tracker
# Run revenue forecasting demo
python -m src.revenue_forecast
# Run all tests
python -m pytest tests/ -v
# or without pytest:
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/chart_export.py
"""
Chart & Export Helpers
=====================
Optional visualization and data-export module. Matplotlib is imported
behind a guard so the rest of the toolkit works even if it is not installed.
Provides:
- Bar charts for revenue by period, category, or channel
- Line charts for trend / forecast visualization
- Funnel diagrams (horizontal bar approximation)
- CSV and JSON export of any analytics result
"""
from __future__ import annotations
import csv
import json
import logging
from dataclasses import asdict, dataclass
from datetime import datetime
from io import StringIO
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence, Tuple
logger = logging.getLogger(__name__)
# Guard matplotlib -- it's not always available and the rest of the toolkit
# should not break if it is missing.
try:
import matplotlib
matplotlib.use("Agg") # non-interactive backend for server environments
import matplotlib.pyplot as plt
HAS_MATPLOTLIB = True
except ImportError:
HAS_MATPLOTLIB = False
logger.info("matplotlib not installed -- chart functions will be unavailable")
def _require_matplotlib() -> None:
if not HAS_MATPLOTLIB:
raise RuntimeError(
"matplotlib is required for charting. Install it with: "
"pip install matplotlib"
)
# ---------------------------------------------------------------------------
# Chart helpers
# ---------------------------------------------------------------------------
# ... 270 more lines ...