π Web analytics in Laravel involves more than adding a tracking script to your Blade layout.
What about server-side events, queued delivery, privacy controls, SPA navigation, or identifying traffic from AI crawlers?
Matomo Analytics for Laravel brings client-side tracking, server-side tracking, and reporting into one Laravel package.
It works with both self-hosted Matomo and Matomo Cloud.
Here's what's included:
π Server-side tracking
Track page views, events, goals, downloads, outbound links, site searches, ecommerce activity, and content interactions directly from Laravel.
A middleware can automatically track page views. Custom events use a dedicated Matomo facade.
π Client-side tracking
Add Matomo through Blade or use Matomo Tag Manager. Track navigation in Livewire, Inertia, and other History API-based applications.
Core Web Vitals (LCP, CLS, INP) can also be recorded as Matomo events.
π Queues and batching
Send hits after the response or collect them into larger batches using Redis, a database, or files.
Failed batches can be isolated and replayed instead of blocking the processing queue.
π€ Bot and AI crawler detection
Exclude known bots and AI crawlers from visitor analytics by default. Recognize AI assistant referrals and optionally record on-demand assistant page fetches as separate server-side telemetry.
π Privacy controls
Cookieless tracking, rotating visitor identifiers, support for Do Not Track and Global Privacy Control, and automatic redaction of sensitive URL parameters and tokens.
The package also integrates with Matomo's PrivacyManager API for GDPR data export and erasure.
π Reporting inside Laravel
Query Matomo's Reporting API using a cached client, fluent query builder, segment builder, and bulk requests.
Additional features include deployment annotations, Artisan commands, connectivity checks, load testing, and test fakes.
Tracking is disabled by default until explicitly enabled and configured.
Analytics should be observable, configurable, and independent of your application's response time.
Supports Laravel 12/13 and PHP 8.4+. MIT licensed.
https://github.com/pushery/matomo-analytics-for-laravel
GitHubGitHub - pushery/matomo-analytics-for-laravel: Privacy-first Matomo analytics for Laravel with cookieless tracking, reports, Web Vitals, batching and bot filtering.Privacy-first Matomo analytics for Laravel with cookieless tracking, reports, Web Vitals, batching and bot filtering. - pushery/matomo-analytics-for-laravel
1 other commit about this linkcommit 15c3574