bezhansalleh/filament-google-analytics
config/filament.php)..env or Vault).config/services.php for secure key storage.guzzlehttp/guzzle (for API calls, included via Filament).spatie/laravel-analytics (optional, if hybrid tracking is needed).laravel-google-analytics) are installed..env:
GOOGLE_ANALYTICS_VIEW_ID=your_view_id
GOOGLE_ANALYTICS_API_KEY=your_api_key
composer require bezhansalleh/filament-google-analytics
Publish config if needed:
php artisan vendor:publish --tag="filament-google-analytics-config"
app/Providers/Filament/PanelProvider.php:
public function panel(Panel $panel): Panel
{
return $panel
->widgets([
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\GoogleAnalyticsOverview::class,
]);
}
config/filament-google-analytics.php).GoogleAnalyticsOverview).config/services.php to avoid hardcoding.filament/filament and google/apiclient are up-to-date.php artisan filament:widgets:list and Tinker (php artisan tinker).// In widget class
protected static ?string $cacheKey = 'filament-ga-metrics';
public static function cacheFor(): ?int { return 1800; }
GuzzleHttp\HandlerStack).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| GA4 API downtime | Widgets show stale/error data | Fallback to cached data or static placeholders. |
| Invalid API key | Widgets fail to load | Validate keys on config publish. |
| API quota exceeded | Partial/missing data | Implement caching and retry logic. |
| Filament upgrade incompatibility | Widgets break | Test in staging before production upgrades. |
| Google Analytics data delay | Stale dashboards | Set user expectations (e.g., "Data updated daily"). |
metrics=users,sessions).GoogleAnalyticsOverview) before full adoption.How can I help you explore Laravel packages today?