PHPackages                             serkanshnn/filament-google-analytics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. serkanshnn/filament-google-analytics

ActiveLibrary

serkanshnn/filament-google-analytics
====================================

Google Analytics integration with Filamentphp (FilamentAdmin)

1.0.2(2y ago)0150MITPHPPHP ^8.1

Since Mar 17Pushed 2y agoCompare

[ Source](https://github.com/serkanshnn/filament-google-analytics)[ Packagist](https://packagist.org/packages/serkanshnn/filament-google-analytics)[ Docs](https://github.com/bezhansalleh/filament-google-analytics)[ GitHub Sponsors](https://github.com/bezhanSalleh)[ RSS](/packages/serkanshnn-filament-google-analytics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (10)Versions (4)Used By (0)

[![filament-google-analytics-art](https://user-images.githubusercontent.com/10007504/156520889-0abeb87d-a231-4f63-a79a-774fbd92ee5c.png)](https://github.com/bezhansalleh/filament-google-analytics) [ ![FILAMENT 8.x](https://camo.githubusercontent.com/c98f15eb6bb59ce4fc768808e21fd46a07d238312928102f3d7ad4bed7c31f70/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d322e782d4542423330343f7374796c653d666f722d7468652d6261646765) ](https://filamentadmin.com/docs/2.x/admin/installation) [ ![Packagist](https://camo.githubusercontent.com/3117f74b24f720698510e51025161cc4da8a417c1332a8d89695962ab7b9a4c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62657a68616e73616c6c65682f66696c616d656e742d676f6f676c652d616e616c79746963732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374) ](https://packagist.org/packages/bezhansalleh/filament-google-analytics) [ ![Tests Passing](https://camo.githubusercontent.com/da867eb2d1fd344826f4e1265ce4cf414574fd090477844f4fe60ee0261fb737/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62657a68616e73616c6c65682f66696c616d656e742d676f6f676c652d616e616c79746963732f72756e2d74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d7465737473) ](https://github.com/bezhansalleh/filament-google-analytics/actions?query=workflow%3Arun-tests+branch%3Amain) [ ![Code Style Passing](https://camo.githubusercontent.com/e92233df4c29d1f889518a0f4fb27bb8e053f19a107987eb2db6d0ab55d900ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f62657a68616e73616c6c65682f66696c616d656e742d676f6f676c652d616e616c79746963732f72756e2d74657374732e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d636f64652532307374796c65) ](https://github.com/bezhansalleh/filament-google-analytics/actions?query=workflow%3A)[ ![Downloads](https://camo.githubusercontent.com/b24e1de43e789e0a9012236f5b952e6cde1bb9e32efce94e77e8683d37eed9d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62657a68616e73616c6c65682f66696c616d656e742d676f6f676c652d616e616c79746963732e7376673f7374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/bezhansalleh/filament-google-analytics)

Filament Google Analytics (GA4)
===============================

[](#filament-google-analytics-ga4)

Google Analytics integration for [Filament (FilamentAdmin)](https://filamentphp.com)

Installation
============

[](#installation)

You can install the package in to a Laravel app that uses [Filament](https://filamentphp.com) via composer:

```
composer require bezhansalleh/filament-google-analytics
```

For now, follow the directions on [Spatie's Laravel Google Analytics package](https://github.com/spatie/laravel-analytics) for getting your credentials, then put them here:

```
yourapp/storage/app/analytics/service-account-credentials.json

```

Also add this to the `.env` for your Filament PHP app:

```
ANALYTICS_PROPERTY_ID=
```

Usage
=====

[](#usage)

All the widgets are enabled by default in a dedicated `Google Analytics Dashboard`. You can enable or disable a specific widget or the dedicated dashboard all together or show and hide some from the main `Filament Dashboard` from the config `filament-google-analytics`.

Publish the config files and set your settings:

```
php artisan vendor:publish --tag=filament-google-analytics-config
```

#### Available Widgets

[](#available-widgets)

```
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\PageViewsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\VisitorsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersOneDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersSevenDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersTwentyEightDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsDurationWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsByCountryWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsByDeviceWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\MostVisitedPagesWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\TopReferrersListWidget::class,
```

#### Custom Dashboard

[](#custom-dashboard)

Though this plugin comes with a default dashboard, but sometimes you might want to change `navigationLabel` or `navigationGroup` or disable some `widgets` or any other options and given that the dashboard is a simple filament `page`; The easiest solution would be to disable the default dashboard and create a new `page`:

```
php artisan filament:page MyCustomDashboardPage
```

then register the widgets you want from the **Available Widgets** list either in the `getHeaderWidgets()` or `getFooterWidgets()`:

```
