jeffersongoncalves / laravel-matomo
A simple and elegant Laravel package that seamlessly integrates Matomo Analytics tracking code into your Blade views.
Installs: 26
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
pkg:composer/jeffersongoncalves/laravel-matomo
Requires
- php: ^8.2|^8.3
- laravel/framework: ^11.0|^12.0|^13.0
- spatie/laravel-package-tools: ^1.14.0
- spatie/laravel-settings: ^3.0
Requires (Dev)
- larastan/larastan: ^3.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.7.4
- pestphp/pest-plugin-laravel: ^3.0
README
Laravel Matomo
A simple and elegant Laravel package that seamlessly integrates Matomo Analytics tracking code into your Blade views. Settings are stored in the database via spatie/laravel-settings, allowing runtime configuration without .env files.
Installation
Install the package via Composer:
composer require jeffersongoncalves/laravel-matomo
Publish the settings migration:
php artisan vendor:publish --tag=matomo-settings-migrations
Run the migration:
php artisan migrate
Usage
Add the tracking script to your Blade layout (typically before </head>):
@include('matomo::script')
Configuration
All settings are stored in the database. You can update them via code:
use JeffersonGoncalves\Matomo\Settings\MatomoSettings; $settings = app(MatomoSettings::class); $settings->domains = 'example.com'; $settings->site_id = '1'; $settings->host_analytics = 'analytics.example.com'; $settings->file = 'matomo.php'; $settings->script = 'matomo.js'; $settings->save();
Available Settings
| Setting | Default | Description |
|---|---|---|
domains |
'' |
Domain(s) for tracking |
site_id |
'1' |
Site ID in Matomo |
host_analytics |
'' |
Matomo server URL (without protocol) |
file |
'matomo.php' |
PHP tracking file |
script |
'matomo.js' |
JS tracking file |
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
