jeffersongoncalves/laravel-matomo

A simple and elegant Laravel package that seamlessly integrates Matomo Analytics tracking code into your Blade views.
922 3
Install
composer require jeffersongoncalves/laravel-matomo
Latest Version:v3.0.0
PHP:^8.2|^8.3|^8.4
License:MIT
Last Updated:Sep 29, 2026
Links: GitHub  ·  Packagist
Maintainer: jeffersongoncalves

Laravel Matomo

Laravel Matomo

Buy Me A Coffee

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

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

Content Security Policy

When your app sets a CSP nonce through Laravel's Vite (Vite::useCspNonce(), as laravel-security-headers does), every <script> this package renders carries it, so a script-src 'self' 'nonce-{nonce}' policy works without 'unsafe-inline'. Scripts loaded afterwards from the vendor's own CDN still need that host in script-src (and its API in connect-src).

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.

Related Packages

jeffersongoncalves/filament-logo

A simple yet effective Filament plugin that automatically adds the Filament logo...

15,610 5
jeffersongoncalves/filament-cookie-consent

This Filament package provides a simple and elegant way to implement cookie cons...

16,055 8
jeffersongoncalves/filament-cep-field

The Filament CEP Field is a custom input component designed specifically for Bra...

5,025 8
jeffersongoncalves/filament-ace-editor-field

A Laravel Filament v5 field that integrates the Ace code editor into your forms,...

11,515 4
jeffersongoncalves/filament-refresh-sidebar

Automatically refresh the Filament sidebar navigation when certain events occur,...

3,230 11

Version History

Version Released PHP Laravel License
v3.0.0 ^8.2|^8.3|^8.4 ^12.61.1|^13.12.0 MIT
v2.0.4 ^8.2|^8.3 ^11.0|^12.0|^13.0 MIT
v2.0.3 ^8.2|^8.3 ^11.0|^12.0|^13.0 MIT
v2.0.2 ^8.2|^8.3 ^11.0|^12.0|^13.0 MIT
v2.0.1 ^8.2|^8.3 ^11.0|^12.0 MIT