jeffersongoncalves / filament-metrics-plausible
Filament plugin with Plausible Analytics dashboard widgets (realtime visitors, visitors chart, top pages, sources, countries, browsers and devices) and a Settings Page powered by Spatie Laravel Settings.
Package info
github.com/jeffersongoncalves/filament-metrics-plausible
pkg:composer/jeffersongoncalves/filament-metrics-plausible
Requires
- php: ^8.2
- filament/filament: ^5.3
- jeffersongoncalves/filament-analytics-core: ^3.0
- jeffersongoncalves/laravel-metrics-plausible: ^1.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Filament Metrics Plausible
Plausible Analytics dashboard widgets for Filament, with a settings page powered by Spatie Laravel Settings to manage your Plausible API key, site ID and instance URL directly from the admin panel. Works with Plausible Cloud and self-hosted instances.
Built on top of jeffersongoncalves/laravel-metrics-plausible (Stats API v2).
Compatibility
| Branch | Filament | Package version |
|---|---|---|
| 1.x | 3.x | ^1.0 |
| 2.x | 4.x | ^2.0 |
| 3.x | 5.x | ^3.0 |
Installation
You can install the package via composer:
composer require jeffersongoncalves/filament-metrics-plausible:"^3.0"
Publish the settings migrations and run them:
php artisan vendor:publish --tag=metrics-plausible-settings-migrations php artisan migrate
Usage
Add the plugin to your Filament panel provider:
use JeffersonGoncalves\Filament\MetricsPlausible\PlausibleMetricsPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ PlausibleMetricsPlugin::make(), ]); }
Then open Settings > Plausible Analytics in your panel and fill in the API key and site ID.
Widgets
All widgets cover the last 30 days and are cached (15s for realtime, 5 minutes for the rest):
| Widget | Shows |
|---|---|
RealtimeVisitorsWidget |
Visitors right now, unique visitors, pageviews, bounce rate and visit duration |
VisitorsChartWidget |
Daily visitors and pageviews line chart |
TopPagesWidget |
Top 10 pages by visitors |
TopSourcesWidget |
Top 10 traffic sources with bounce rate |
TopCountriesWidget |
Top 10 countries with share of visitors |
TopBrowsersWidget |
Browsers doughnut chart |
TopDevicesWidget |
Devices doughnut chart |
Customization
PlausibleMetricsPlugin::make() ->settingsPage(false) // hide the settings page ->widgets(false), // don't register the dashboard widgets
With widgets(false) you can still place the widget classes on any page yourself.
Requirements
- PHP 8.2 or higher
- Filament 5.x
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.
