Google Analytics by Bezhan Salleh
CommunityGoogle Analytics integration for Filament Panels with a set of widgets to display your Google Analytics data in a beautiful way.
Author:
Bezhan Salleh
Package health
Automated checks of this plugin's Composer package
15 checks
- Passed: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Passed: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Skipped: Renovate MR responsiveness
- Passed: Dependabot or Renovate configured
- Passed: Dependency update cooldown configured
- Passed: Provides a security policy
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 0 days ago; last release 221 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
-
Passed:
Current Laravel version supported
—
Package dependencies resolve together with current Laravel
13.0. -
Passed:
Current PHP version supported
—
Constraint
^8.3supports current PHP8.5. - Skipped: Current Symfony version supported
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
- Installation
- Configuration
- Usage
- Preview
- Upgrading
- Testing
- Version Support
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Bring your Google Analytics 4 data into Filament Panels. The plugin ships a dedicated dashboard page and a set of widgets that show page views, visitors, sessions, active users, devices, countries, top pages and referrers, each with its own period filter.
#Installation
Install the package with Composer:
composer require bezhansalleh/filament-google-analytics
The plugin reads your analytics data through Spatie's Laravel Analytics package. Follow its guide to create a service account and download the credentials, then place the file at:
storage/app/analytics/service-account-credentials.json
Add your GA4 property ID to your .env file:
ANALYTICS_PROPERTY_ID=
Important
The plugin follows Filament's theming rules. Create a custom theme if you haven't already, then add the following lines to your theme's CSS file:
@source '../../../../vendor/bezhansalleh/filament-google-analytics/resources/views/**/*';
@source '../../../../vendor/bezhansalleh/filament-google-analytics/src/{Widgets,Support}/*';
Register the plugin in your panel provider:
use BezhanSalleh\GoogleAnalytics\GoogleAnalyticsPlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
GoogleAnalyticsPlugin::make(),
]);
}
#Configuration
Publish the config file to change the defaults:
php artisan vendor:publish --tag=google-analytics-config
The config file lets you:
- Enable or disable the dedicated dashboard page and set its navigation icon.
- Control where each widget appears through its
filament_dashboardandglobaloptions. See Widget Visibility. - Change the icons and colors the stat widgets use for upward, downward and steady trends.
#Usage
#Dedicated Dashboard
The plugin registers a Google Analytics page in your panel's navigation and renders every widget on it. Set dedicated_dashboard to false in the config file to remove the page.
#Available Widgets
use BezhanSalleh\GoogleAnalytics\Widgets;
Widgets\PageViewsWidget::class,
Widgets\VisitorsWidget::class,
Widgets\ActiveUsersOneDayWidget::class,
Widgets\ActiveUsersSevenDayWidget::class,
Widgets\ActiveUsersTwentyEightDayWidget::class,
Widgets\SessionsWidget::class,
Widgets\SessionsByCountryWidget::class,
Widgets\SessionsDurationWidget::class,
Widgets\SessionsByDeviceWidget::class,
Widgets\MostVisitedPagesWidget::class,
Widgets\TopReferrersListWidget::class,
#Widget Visibility
Each widget has two options in the config file:
| Option | Effect |
|---|---|
filament_dashboard |
Show the widget on Filament's default dashboard. Off by default. |
global |
Show the widget on the dedicated dashboard and on any other page where you register it. |
Set filament_dashboard to true for every widget you want on Filament's own dashboard.
#Custom Dashboard
The dedicated dashboard is a plain Filament page. To change its navigation label or group, pick a subset of widgets, or apply any other customization, disable the dedicated dashboard and create your own page:
php artisan make:filament-page MyCustomDashboardPage
Register the widgets you want in getHeaderWidgets() or getFooterWidgets():
<?php
namespace App\Filament\Pages;
use BezhanSalleh\GoogleAnalytics\Widgets;
use Filament\Pages\Page;
class MyCustomDashboardPage extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected string $view = 'filament.pages.my-custom-dashboard-page';
protected function getHeaderWidgets(): array
{
return [
Widgets\PageViewsWidget::class,
Widgets\VisitorsWidget::class,
Widgets\ActiveUsersOneDayWidget::class,
Widgets\ActiveUsersSevenDayWidget::class,
Widgets\ActiveUsersTwentyEightDayWidget::class,
Widgets\SessionsWidget::class,
Widgets\SessionsByCountryWidget::class,
Widgets\SessionsDurationWidget::class,
Widgets\SessionsByDeviceWidget::class,
Widgets\MostVisitedPagesWidget::class,
Widgets\TopReferrersListWidget::class,
];
}
}
#Preview
The widgets rendered on the dedicated dashboard. They look the same on any page you add them to.

#Upgrading
When you upgrade from 2.x to 3.x, replace the BezhanSalleh\FilamentGoogleAnalytics namespace with BezhanSalleh\GoogleAnalytics everywhere you reference the plugin.
#Testing
composer test
#Version Support
Only the latest major plugin line receives active development. Older lines stay installable for legacy projects but get no new features; they only receive security fixes while their Filament target is still supported upstream.
See CHANGELOG for migration notes between majors.
#Changelog
See CHANGELOG for the list of recent changes.
#Contributing
If you want to contribute to this package, test it in a real Filament project:
- Fork this repository to your GitHub account.
- Create a Filament app locally.
- Clone your fork in your Filament app's root directory.
- In the
/filament-google-analyticsdirectory, create a branch for your fix, e.g.fix/error-message.
Install the package in your app's composer.json:
"require": {
"bezhansalleh/filament-google-analytics": "dev-fix/error-message as main-dev",
},
"repositories": [
{
"type": "path",
"url": "filament-google-analytics"
}
]
Now, run composer update.
See CONTRIBUTING for details.
#Security Vulnerabilities
Review our security policy to learn how to report security vulnerabilities.
#Credits
#License
The MIT License (MIT). See the License File for more information.
The author
Bezhan Salleh is a full-stack developer with a strong focus on backend development and a passion for open-source. He’s the creator of Shield, Filament’s most starred plugin, and the author of other popular plugins, including Plugin Essentials and Google Analytics. His work focuses on delivering practical, powerful solutions with an emphasis on performance and developer experience.
From the same author
Plugin Essentials
A collection of essential traits that streamline Filament plugin development by taking care of the boilerplate, so you can focus on shipping real features faster.
Author:
Bezhan Salleh
Shield
The easiest and most intuitive way to handle `Policies` and `Permissions for your Filament Panels' components.
Author:
Bezhan Salleh
Panel Switch
Switch between Filament panels with ease.
Author:
Bezhan Salleh
Language Switch
A versatile, feature-rich, drop-in language switch for any Filament Panels.
Author:
Bezhan Salleh
Featured Plugins
A selection of plugins curated by the Filament team
Soft Theme
A theme that gives panels a warm, approachable look with rounded shapes, gentle colors, and serif headings.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese
Noir Theme
A theme that gives panels a focused, refined look with near-black surfaces, crisp actions, and restrained color.
Filament