Download the PHP package fyrndly/laravel-matomo-tracker without Composer
On this page you can find all versions of the php package fyrndly/laravel-matomo-tracker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-matomo-tracker
Laravel Matomo Tracker
A seamless and lightweight Matomo Analytics integration for Laravel application tracking. This package wraps the official Matomo PHP Tracker to provide a Laravel-friendly syntax, including Facades, auto-configuration, and background processing.
Features
- Auto-configuration: Automatically detects Client IP, User-Agent, and Browser Language.
- Queue Support: Dispatch tracking requests to the background for high-performance applications.
- User Tracking: Automatically links Matomo User ID with Laravel Auth (configurable attribute).
- Smart Event Tracking: Supports strings, arrays, or objects as payloads (automatically encoded).
- Flexible Tracking: Supports Page Views, Custom Events, Site Search, and Goals.
- Custom Dimensions: Easily set custom dimensions for your tracking data.
- Laravel Integration: Includes a Facade and Service Provider with auto-discovery.
Installation
You can install the package via composer:
The package will automatically register its service provider and facade.
Configuration
First, publish the configuration file:
Then, add your Matomo details to your .env file:
Configuration Options
url: Your Matomo server URL.site_id: Your Matomo site ID.token: Required for manual IP tracking or administrative features.user_id_attribute: The attribute from the User model to use as the Matomo User ID (e.g.,email,id).queue: Set totrueto handle tracking in the background. Requires a working Laravel Queue worker.
Usage
Using the Facade
Enhanced Event Tracking
The event method supports complex data. If you pass an array or object to the $payload parameter, it will be automatically JSON-encoded and Base64-encoded for safe storage in Matomo.
Livewire & Filament Auto-Tracking
You can effortlessly track page views in your Livewire components or Filament pages by simply including the MatomoTrackView trait. It hooks into the component's lifecycle and automatically resolves the page title.
Note: This trait smartly looks for $pageTitle, $title, $heading properties, or getTitle(), getHeading(), getRecordTitle() methods (perfect for Filament v3).
High Traffic Handling (Queue)
For high-traffic applications, it is highly recommended to enable the queue to prevent API latency from affecting the user experience.
- Set
MATOMO_QUEUE=truein your.env. - Ensure your
QUEUE_CONNECTIONis not set tosync. - Run your queue worker:
php artisan queue:work.
Custom Dimensions
You can set custom dimensions before tracking:
Manual User ID
If you need to manually set or override the User ID for a specific request:
Accessing the Raw Tracker
If you need to access methods directly from the underlying MatomoTracker instance:
Credits
- FyrnDly
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-matomo-tracker with dependencies
matomo/matomo-php-tracker Version ^3.4
illuminate/support Version ^8.0|^9.0|^10.0|^11.0