standalone-analytics
[Image: License: AGPL v3 or later](https://github.com/localzet/standalone-analytics/blob/HEAD/LICENSE) [Image: PHP](https://github.com/localzet/standalone-analytics/blob/HEAD/php/composer.json) [Image: Laravel](https://github.com/localzet/standalone-analytics/blob/HEAD/laravel/composer.json) [Image: Node.js](https://github.com/localzet/standalone-analytics/blob/HEAD/tracker/package.json)
Standalone, single-project analytics extracted from the Localzet Analytics tracking model. The folder is intentionally a small integration kit rather than another SaaS application.
It contains:
laravel/— production-oriented Laravel 13 adapter with PostgreSQL partitions, queues, rollups, S3-compatible replay/heatmap storage and a complete protected analytics console;php/— framework-agnostic MySQL/PDO ingestion, goals and reports for small non-Laravel integrations;tracker/— TypeScript browser SDK with autocapture, attribution, product/ecommerce events, diagnostics, heatmaps and rrweb recording;examples/plain-php/— minimal collector/reporting endpoints and an admin page;docs/architecture.md— extraction decisions and a mapping from the original monolith.
Release preparation for Packagist and npm is documented in docs/publishing.md.
Packages
Заголовок раздела «Packages»The three packages are independently publishable:
cd phpcomposer install
cd ../laravelcomposer install
cd ../trackernpm installnpm run buildApply php/database/mysql.sql, construct Localzet\PersonalAnalytics\Analytics, and route JSON requests to Collector::collect(). See examples/plain-php for a complete adapter.
Browser integration:
import { createAnalytics } from '@localzet/personal-analytics-tracker';
const analytics = createAnalytics({ endpoint: 'https://admin.example.test/analytics/collect.php', projectToken: 'replace-with-a-random-public-token', ignoreDnt: true, autocapture: true, trackPerformance: true, trackErrors: true, trackNetwork: true, recordReplays: true, replaySampleRate: 0.25, goals: [{ key: 'checkout', type: 'pageview', path: '/checkout/success' }], heatmaps: [{ key: 'home', path: '/' }],});
analytics.start();analytics.goal('signup');analytics.track('pricing_calculator_used', { plan: 'business' });analytics.ecommerce('purchase', { orderId: 'A-42', revenue: 1990, currency: 'RUB' });ignoreDnt is explicit. Without it, the tracker does not start when DNT is enabled. Input values are masked in rrweb; request bodies, form values, credentials and payment data are never collected. Sensitive keys are redacted before transport and again on the server.
This kit has exactly one analytics project per installation. It has no users, websites, teams, plans, billing or quotas. The console can use the host application’s Laravel authentication or its own independent admin token. The public project token identifies traffic but is never accepted as an admin secret; ingestion is additionally restricted by the configured host/origin.
License
Заголовок раздела «License»Licensed under AGPL-3.0-or-later. When redistributing the project or substantial portions of it, keep the copyright, license and attribution notices, including the link to the original repository. See NOTICE.
rrweb and other third-party dependencies are distributed under their respective licenses.
Исходный код · AGPL-3.0