laravel-pirsch maintained by jeffersongoncalves

Laravel Pirsch
Add Pirsch — cookie-free, privacy-friendly web analytics made in Germany — to your Laravel app. The settings are stored in the database with spatie/laravel-settings, so you can change them at runtime (e.g. from an admin panel) instead of in .env.
For a Filament settings page, use jeffersongoncalves/filament-pirsch.
Installation
composer require jeffersongoncalves/laravel-pirsch
Publish and run the settings migration:
php artisan vendor:publish --tag=pirsch-settings-migrations
php artisan migrate
Configuration
$settings = pirsch_settings();
$settings->identification_code = 'AbCdEf0123456789AbCdEf0123456789';
$settings->save();
Or through the settings class or the Facade:
use JeffersonGoncalves\Pirsch\Facades\Pirsch;
use JeffersonGoncalves\Pirsch\Settings\PirschSettings;
$settings = app(PirschSettings::class);
$value = Pirsch::getFacadeRoot()->identification_code;
Available settings
| Setting | Type | Default | Description |
|---|---|---|---|
identification_code |
?string |
null |
Your Pirsch identification code. The script only renders when it is valid. |
Usage
Add the script to your Blade layout, inside <head>:
@include('pirsch::script')
Nothing is rendered until the settings are complete, so you can ship the include everywhere and turn Pirsch on later.
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.