About this project
Laravel Umami provides a straightforward way to add Umami analytics to a Laravel application. The package relies on spatie/laravel-settings to keep all Umami configuration values in the database, making it easy to change settings without touching code.
Key features:
- Simple Blade inclusion: add @include('umami::script') to your layout to load the tracking script.
- Database‑driven settings: website ID, host URL, domain whitelist, auto‑track flag, and other options are stored in the settings table and can be edited via code or an admin UI.
- Automatic tracking of pageviews and events out of the box, with options to exclude query strings or hash fragments.
- Supports custom tags and domain restrictions for more precise analytics.
Installation steps:
1. Require the package with Composer.
2. Ensure spatie/laravel-settings is installed and its migration has been run.
3. Publish and run the Umami settings migration provided by the package.
4. Add the script include to your Blade layout.
Configuration example (PHP):
```
use JeffersonGoncalves\Umami\Settings\UmamiSettings;
$settings = app(UmamiSettings::class);
$settings->website_id = 'your-website-id';
$settings->host_analytics = 'https://your-umami-instance.com';
$settings->save();
```
Available settings include:
- website_id (required)
- host_analytics (default https://cloud.umami.is)
- host_url (optional override)
- auto_track (boolean, default true)
- domains (comma‑separated list)
- tag (optional grouping tag)
- exclude_search and exclude_hash (booleans to strip URL parts)
The package is compatible with PHP 8.2+ and Laravel 11+. Tests can be run via `composer test`. It is released under the MIT license.
For more details, see the repository's README, changelog, and contribution guidelines.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.