An open API service indexing awesome lists of open source software.

https://github.com/verygoodplugins/vgp-edd-stats


https://github.com/verygoodplugins/vgp-edd-stats

Last synced: 6 days ago
JSON representation

Awesome Lists containing this project

README

          

# VGP EDD Stats Dashboard

Modern analytics dashboard for Easy Digital Downloads with advanced filtering, comparisons, and charts.

## Features

- 7 dashboard pages: Customers & Revenue, MRR & Growth, Renewals & Cancellations, Refunds, Software Licensing, Sites Stats, Support
- Date range filtering with presets
- REST API endpoints with transient caching
- React + ECharts UI bundled via Vite

## Requirements

- WordPress 6.0+
- PHP 8.0+
- Easy Digital Downloads 3.0+
- Node.js 16+ (for development)

## Installation

1. Upload `vgp-edd-stats/` to `/wp-content/plugins/`
2. Activate via WordPress admin
3. Open **EDD Stats** in the admin menu

## Development

```bash
npm install
npm run dev
npm run build
```

### Project Structure

```
vgp-edd-stats/
├── includes/ # PHP classes
│ ├── class-admin-page.php
│ ├── class-stats-api.php
│ └── class-stats-query.php
├── src/ # React source (Vite)
│ ├── components/
│ ├── pages/
│ ├── utils/
│ ├── App.jsx
│ └── index.jsx
├── build/ # Compiled assets (generated)
├── scripts/ # Dev utilities (optional)
├── data/ # Local DB dumps (gitignored)
└── vgp-edd-stats.php # Main plugin file
```

## Syncing Live Data to Local Development (Optional)

The `scripts/sync-live-data.sh` script can pull EDD tables from a live site into a local dev database and anonymize customer data.

### Setup

```bash
cp scripts/.env.example scripts/.env
chmod +x scripts/sync-live-data.sh
./scripts/sync-live-data.sh
```

For LocalWP users, local DB host/port/user/password are usually auto-detected from your site’s `local-site.json` (or `wp-config.php`) so you typically only need to set `LIVE_SSH` + `LIVE_WP_PATH`.

### Dev Database Mode

```bash
cp dev-config-sample.php dev-config.php
```

When `dev-config.php` exists and `VGP_EDD_STATS_DEV_MODE` is `true`, the plugin queries the dev database for stats instead of the WordPress database.

## REST API Endpoints

All endpoints are available at `/wp-json/vgp-edd-stats/v1/`.

### Customers & Revenue

- `GET /customers/by-month` - New customers by month
- `GET /customers/yoy-change` - Year-over-year change
- `GET /revenue/by-month` - Revenue breakdown
- `GET /revenue/refunded` - Refunded revenue

### MRR & Growth

- `GET /mrr/by-month` - MRR over time
- `GET /mrr/current` - Current month MRR breakdown

### Renewals

- `GET /renewals/rates` - Renewal rates by month
- `GET /renewals/upcoming?days=30` - Upcoming renewals

### Refunds

- `GET /refunds/rates` - Refund rates by month

### Licensing

- `GET /licenses/top?limit=20` - Top licenses by activations

### Utility

- `POST /cache/clear` - Clear all cached data
- `GET /health` - Health check

## Settings

Settings live under **EDD Stats → Settings**:

- Cache duration (seconds)
- Default date range (including “All Time”)
- Clear cached stats

## License

GPL-3.0-or-later