personal-analytics
Framework-neutral, single-project analytics collector and reporting library for PHP 8.2+ and MySQL 8.
composer require localzet/personal-analyticsApply database/mysql.sql, create a PDO connection and construct the analytics facade:
use Localzet\PersonalAnalytics\Analytics;use Localzet\PersonalAnalytics\Config;
$analytics = new Analytics($pdo, new Config( projectToken: $_ENV['ANALYTICS_TOKEN'], allowedHost: 'app.example.com', allowedOrigins: ['https://app.example.com'],));Route collector JSON to $analytics->collector->collectJson(). Protect reporting endpoints with the host application’s authentication and authorization. A complete minimal adapter is available in ../examples/plain-php.
The package stores lifecycle events, safe interactions, UTM attribution, goals, heatmaps and compressed replay chunks. Sensitive values must never be passed as custom properties; the collector also redacts common sensitive keys.
License
Section titled “License”Licensed under AGPL-3.0-or-later. Preserve the included NOTICE when redistributing the package.
Source · AGPL-3.0