WooCommerce Performance Analytics
Comprehensive analytics plugin for WooCommerce with profit tracking, customer LTV, marketing ROI, and courier performance monitoring
by Mushfikur Rahman · github.com/mushfikur-dwip/woocommerce-analytics
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mushfikur-dwip/woocommerce-analytics/archive/refs/heads/main.zipA comprehensive analytics plugin for WooCommerce that tracks profit per SKU, customer lifetime value (LTV), marketing channel ROI, and courier performance.
Features
1. Profit per SKU
- Track cost of goods sold (COGS) per product
- Calculate profit margins automatically
- View profit analysis by product, date range, and category
- Export detailed profit reports to CSV
2. Customer Lifetime Value (LTV)
- Automatic LTV calculation on order completion
- Customer segmentation (Platinum, Gold, Silver, Bronze)
- Track total orders, average order value, and purchase frequency
- Identify active vs inactive customers
- Predict future customer value
3. Marketing Channel ROI
- Automatic UTM parameter tracking
- Attribution tracking for all orders
- ROI calculation per marketing channel
- Cost per conversion metrics
- Support for manual marketing spend input
4. Courier Performance
- Track delivery times by courier
- Monitor on-time delivery rates
- Identify delay sources and patterns
- Compare courier performance metrics
- Visual performance charts
Installation
-
Download or clone this repository to your WordPress plugins directory:
/wp-content/plugins/woocommerce-analytics/ -
Go to WordPress Admin → Plugins
-
Find "WooCommerce Performance Analytics" and click Activate
-
The plugin will automatically create necessary database tables
Requirements
- WordPress 5.8 or higher
- WooCommerce 5.0 or higher
- PHP 7.4 or higher
Usage
Setting Up Product Costs
- Go to Products → Edit any product
- Find the "Product Costs & Profit Settings" metabox in the sidebar
- Enter:
- Cost Price (COGS)
- Additional Costs (packaging, processing)
- Shipping Cost (per unit)
- Profit margins will be calculated automatically
Tracking Courier Performance
- Go to WooCommerce → Orders
- Open any order
- Find the "Courier Tracking & Performance" metabox
- Enter:
- Courier Name (select from dropdown)
- Tracking Number
- Dispatch Date
- Estimated Delivery Date
- When order is completed, actual delivery date is recorded automatically
- View courier performance reports in WC Analytics → Courier Performance
UTM Tracking for Marketing Attribution
Marketing attribution is tracked automatically when customers visit your site with UTM parameters:
Example URL:
https://yoursite.com/?utm_source=facebook&utm_medium=cpc&utm_campaign=spring_sale
UTM parameters are stored in cookies and attributed to orders when customers complete checkout.
Viewing Reports
Navigate to WC Analytics in the WordPress admin menu:
- Dashboard - Overview of all metrics with charts
- SKU Profits - Detailed profit analysis by product
- Customer LTV - Customer value rankings and segments
- Marketing ROI - Channel performance and ROI metrics
- Courier Performance - Delivery time and reliability statistics
Exporting Data
All reports include "Export to CSV" buttons for downloading data in spreadsheet format.
Database Tables
The plugin creates 4 custom tables:
wp_wc_analytics_sku_costs- Product costs and profit calculationswp_wc_analytics_customer_ltv- Customer lifetime value datawp_wc_analytics_attribution- Marketing attribution trackingwp_wc_analytics_courier_performance- Courier delivery metrics
Permissions
By default, the following user roles can access analytics:
- Administrator - Full access to all features
- Shop Manager - Full access to all features
You can customize permissions by modifying the capability checks in the code.
Customization
Customer Segments
Customer segments are based on spending thresholds. Edit class-ltv-calculator.php:
private function get_customer_segment($total_spent, $total_orders) {
if ($total_spent >= 5000 || $total_orders >= 20) {
return 'platinum';
} elseif ($total_spent >= 2000 || $total_orders >= 10) {
return 'gold';
} elseif ($total_spent >= 500 || $total_orders >= 5) {
return 'silver';
} else {
return 'bronze';
}
}
Courier List
To add more couriers, edit class-courier-manager.php and update the $couriers array:
$couriers = array(
'Pathao' => 'Pathao',
'Redx' => 'Redx',
'Your Courier' => 'Your Courier',
// Add more here
);
Troubleshooting
Data Not Showing
- Ensure products have cost prices set
- Complete at least one order after plugin activation
- Check that WooCommerce orders are marked as "Completed" or "Processing"
UTM Parameters Not Tracking
- Clear browser cookies
- Test with a new incognito/private window
- Verify UTM parameters are in the URL when visiting the site
Database Tables Not Created
- Deactivate and reactivate the plugin
- Check database user has CREATE TABLE permissions
- Check WordPress debug log for errors
Uninstallation
When you uninstall the plugin:
- All custom database tables are dropped
- All plugin options are deleted
- Product cost meta data is preserved (can be manually deleted if needed)
Security
The plugin follows WordPress security best practices:
- Nonce verification on all forms
- Capability checks before sensitive operations
- SQL injection prevention with prepared statements
- Input sanitization and output escaping
- CSRF protection
Support
For issues, questions, or feature requests, please contact the plugin author or create an issue in the repository.
Changelog
Version 1.0.0 (December 2025)
- Initial release
- SKU profit tracking
- Customer LTV calculations
- Marketing attribution
- Courier performance monitoring
- Interactive dashboards with Chart.js
- CSV export functionality
Credits
Developed by Mushfikur Rahman
License
GPL v2 or later